[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFhGd8rUz_wG+jkW=+17RpG2BQxaRMmZVk=g=G1FogMSeAD7jA@mail.gmail.com>
Date: Thu, 11 Apr 2024 15:10:57 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Joe Perches <joe@...ches.com>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>, Andy Whitcroft <apw@...onical.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>, Lukas Bulwahn <lukas.bulwahn@...il.com>,
linux-kernel@...r.kernel.org, Lee Jones <lee@...nel.org>,
linux-hardening@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Finn Thain <fthain@...ux-m68k.org>
Subject: Re: [PATCH v4] checkpatch: add check for snprintf to scnprintf
On Thu, Apr 11, 2024 at 1:56 PM Joe Perches <joe@...ches.com> wrote:
> It could.
>
> # {v}snprintf uses that should likely be {v}scnprintf
> if ($line =~ /\b((v?)snprintf)\s*\(/) {
> WARN("SNPRINTF",
> "Prefer ${2}scnprintf over $1 - see: https://github.com/KSPP/linux/issues/105\n" . $herecurr);
> }
>
>
>
> Though I also think it's better to use lore rather than github
I am fine with making the UX change in v5 regarding using ${2} and $1
but I wish someone could have said something about the Github links
earlier, we already have a pattern going with these string api
changes:
"Prefer strscpy over strcpy - see:
https://github.com/KSPP/linux/issues/88\n" . $herecurr);
}
..
# strlcpy uses that should likely be strscpy
if ($line =~ /\bstrlcpy\s*\(/) {
WARN("STRLCPY",
"Prefer strscpy over strlcpy - see:
https://github.com/KSPP/linux/issues/89\n" . $herecurr);
}
# strncpy uses that should likely be strscpy or strscpy_pad
if ($line =~ /\bstrncpy\s*\(/) {
WARN("STRNCPY",
"Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see:
https://github.com/KSPP/linux/issues/90\n" . $herecurr);
}
# {v}snprintf uses that should likely be {v}scnprintf
if ($line =~ /\b(v|)snprintf\s*\(/) {
WARN("SNPRINTF",
"Prefer ${2}scnprintf over $1 - see:
https://github.com/KSPP/linux/issues/105\n" . $herecurr);
..
It should be noted that nowhere else is a lore link or github link
provided during a warning, so there really is no precedence. Joe what
should we do?
>
Powered by blists - more mailing lists