From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org,
Richard Henderson <richard.henderson@linaro.org>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>,
linux-alpha@vger.kernel.org, Julia Lawall <Julia.Lawall@inria.fr>
Subject: Re: [PATCH] alpha: move from strlcpy with unused retval to strscpy
Date: Fri, 19 Aug 2022 07:37:53 +0200 [thread overview]
Message-ID: <Yv8hsfcAw6e81/9z@shikoro> (raw)
In-Reply-To: <f2cef25c1e092fc3e9f7312b85762b487d67e3ff.camel@perches.com>
[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-08-19 5:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 20:59 [PATCH] alpha: move from strlcpy with unused retval to strscpy Wolfram Sang
2022-08-18 23:40 ` Joe Perches
2022-08-19 5:37 ` Wolfram Sang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yv8hsfcAw6e81/9z@shikoro \
--to=wsa+renesas@sang-engineering.com \
--cc=Julia.Lawall@inria.fr \
--cc=ink@jurassic.park.msu.ru \
--cc=joe@perches.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).