public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: apw@canonical.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com,  skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linux.dev,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] checkpatch: suppress strscpy warnings for userspace tools
Date: Tue, 29 Jul 2025 06:44:45 -0700	[thread overview]
Message-ID: <2a2bb7879e22208205fbb8f9bc56fb3c882bc307.camel@perches.com> (raw)
In-Reply-To: <CAO9wTFhCb7gDEo+q2SAZcn2KdUyVe-fG1E4bR_+US9k2J9DOnw@mail.gmail.com>

On Tue, 2025-07-29 at 17:15 +0530, Suchit Karunakaran wrote:
> On Tue, 29 Jul 2025 at 15:54, Joe Perches <joe@perches.com> wrote:
> > 
> > On Sun, 2025-07-27 at 18:20 +0530, Suchit Karunakaran wrote:
> > > The checkpatch.pl script currently warns against the use of strcpy,
> > > strlcpy, and strncpy, recommending strscpy as a safer alternative.
> > > However, these warnings are also triggered for code under tools/ and
> > > scripts/, which are userspace utilities where strscpy is not available.
> > > This patch suppresses these warnings for files in tools/ and scripts/.
> > > 
> > > Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
> > > 
> > > Changes since v1:
> > > - Create is_userspace function to check if the file is in userspace
> > >   directories
> > 
> > the changelog bit should go below the --- line
> > 
> > > ---
> > 
> > This
> 
> Sorry I will change it in the next version.
> 
> > >  scripts/checkpatch.pl | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > []
> > > @@ -7019,20 +7019,24 @@ sub process {
> > >  #                    }
> > >  #            }
> > > 
> > > +        sub is_userspace {
> > > +            my ($file) = @_;
> > > +            return ($file =~ m@\btools/@ || $file =~ m@\bscripts/@);
> > 
> > All other sub uses start in without indentation.
> > Please move this next to other sub blocks.
> > 
> 
> Yup will do it.
> 
> > Please do a git ls-files -- '*tools/' and see if too many other
> > files are matched, especially the Documentation/ ones.
> > 
> 
> I didn't quite understand this. Could you please elaborate?

The search pattern m@\btools/@ matches files other than the
first level tools/ directory.

It also matches Documentation/tools/

Perhaps using m@^tools/@ to match only the first level tools
and change $file to $realfile to make it clear it's not
a/tools or b/tools like the diff filenames.


  reply	other threads:[~2025-07-29 13:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-27 12:50 [PATCH v2] checkpatch: suppress strscpy warnings for userspace tools Suchit Karunakaran
2025-07-29 10:24 ` Joe Perches
2025-07-29 11:45   ` Suchit Karunakaran
2025-07-29 13:44     ` Joe Perches [this message]
2025-07-29 14:44       ` Suchit Karunakaran
2025-07-29 14:59       ` Suchit Karunakaran
2025-07-29 16:08         ` Joe Perches
2025-07-29 14:42 ` Markus Elfring
2025-07-29 14:45   ` Suchit Karunakaran
2025-07-29 14:55     ` Greg KH

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=2a2bb7879e22208205fbb8f9bc56fb3c882bc307.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --cc=suchitkarunakaran@gmail.com \
    /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