Re: [PATCH 2/2] scripts: checkpatch.pl: add warning for strlcat()

From: Manuel Ebner

Date: Tue May 12 2026 - 03:36:46 EST


On Mon, 2026-05-11 at 14:27 +0100, David Laight wrote:
> On Mon, 11 May 2026 06:12:36 -0600
> Jonathan Corbet <corbet@xxxxxxx> wrote:
>
> > Manuel Ebner <manuelebner@xxxxxxxxxxx> writes:
> >
> > > add a warning for strlcat()
> > >
> > > Signed-off-by: Manuel Ebner <manuelebner@xxxxxxxxxxx>
> > > ---
> > >  scripts/checkpatch.pl | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index 0492d6afc9a1..ca1a8e67d529 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -7085,6 +7085,12 @@ sub process {
> > >        "Prefer strscpy over strlcpy - see:
> > > https://github.com/KSPP/linux/issues/89\n"; . $herecurr);

Here you can see the external urls already deployed. there are two more in 
the code blocks above.

> > >   }
> > >  
> > > +# strlcat uses that should likely be
> > > + if ($line =~ /\bstrlcat\s*\(/ && !is_userspace($realfile)) {
> > > + WARN("STRLCAT",
> > > +      "Prefer seq_buf_printf() over strlcat - see:
> > > https://github.com/KSPP/linux/issues/370\n"; . $herecurr);
> > > + } 
> >
> > Using seq_buf_printf() requires switching over to the seq_buf API in
> > general, it is not just a simple substitution, so this advice may prove
> > unhelpful to many.
>
> And I'm not sure the external url is a good idea.

It wasn't my idea originally. but I'm open to suggestions.

Manuel

> >
> > jon
> >