lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAO9wTFg5g5GjY=g2T6m7-jbAg_0U+OttpspxNQZ8ONK=gGJHCg@mail.gmail.com>
Date: Tue, 29 Jul 2025 20:29:55 +0530
From: Suchit Karunakaran <suchitkarunakaran@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: apw@...onical.com, dwaipayanray1@...il.com, lukas.bulwahn@...il.com, 
	skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] checkpatch: suppress strscpy warnings for userspace tools

On Tue, 29 Jul 2025 at 19:14, Joe Perches <joe@...ches.com> wrote:
>
> On Tue, 2025-07-29 at 17:15 +0530, Suchit Karunakaran wrote:
> > On Tue, 29 Jul 2025 at 15:54, Joe Perches <joe@...ches.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@...il.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@...ols/@ 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.
>

On a related note, should we also suppress warnings for the
Documentation folder?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ