lkml.org 
[lkml]   [2022]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] alpha: move from strlcpy with unused retval to strscpy
Hi Joe,

Glad you like this series.

> Last time I posted a coccinelle script for strlcpy->strscpy conversions
> with unused returns, there were several variants that were not converted.
>
> https://lore.kernel.org/cocci/a3279a5772b2e49b57890cd75e97360b82890798.camel@perches.com/T/#m502108bfe0cc6a41d499a4c1b55d5f5db1423465
>
> Did you post the script you used?

First version here, very similar to yours:

https://lore.kernel.org/all/YvhXzarjOLEJ8nsW@shikoro/

The final version has another rule to add missing parens to the argument
of a sizeof operator:

@ main @
@@
- strlcpy
+ strscpy
(...);

// make sure sizeof always has parens. Isomorphs will remove existing ones if present before.
@ add_parens depends on main @
expression dst, src, E;
@@
strscpy(dst, src,
- sizeof(E)
+ sizeof(E)
);

Like your try, some header files are missing. I guess Julia's remarks
about that from the thread above will fix this as well. However, since
there are the instances left where the return value of strlcpy is used
anyhow, I left those for manual fixing.

Thanks,

Wolfram

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-08-19 07:39    [W:0.848 / U:1.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site