[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yv8hsfcAw6e81/9z@shikoro>
Date: Fri, 19 Aug 2022 07:37:53 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel@...r.kernel.org,
Richard Henderson <richard.henderson@...aro.org>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>, linux-alpha@...r.kernel.org,
Julia Lawall <Julia.Lawall@...ia.fr>
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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists