Messages in this thread | | | Date | Fri, 19 Aug 2022 07:37:53 +0200 | From | Wolfram Sang <> | Subject | Re: [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] | |