mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + checkpatch-prefer-strscpy-to-strlcpy.patch added to -mm tree
@ 2020-12-23 20:37 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-23 20:37 UTC (permalink / raw)
  To: mm-commits, akpm, joe


The patch titled
     Subject: checkpatch: prefer strscpy to strlcpy
has been added to the -mm tree.  Its filename is
     checkpatch-prefer-strscpy-to-strlcpy.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/checkpatch-prefer-strscpy-to-strlcpy.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-prefer-strscpy-to-strlcpy.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: prefer strscpy to strlcpy

Prefer strscpy over the deprecated strlcpy function.

Link: https://lkml.kernel.org/r/19fe91084890e2c16fe56f960de6c570a93fa99b.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Requested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 scripts/checkpatch.pl |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/scripts/checkpatch.pl~checkpatch-prefer-strscpy-to-strlcpy
+++ a/scripts/checkpatch.pl
@@ -6646,6 +6646,12 @@ sub process {
 #			}
 #		}
 
+# strlcpy uses that should likely be strscpy
+		if ($line =~ /\bstrlcpy\s*\(/) {
+			WARN("STRLCPY",
+			     "Prefer strscpy over strlcpy - see: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw\@mail.gmail.com/\n" . $herecurr);
+		}
+
 # typecasts on min/max could be min_t/max_t
 		if ($perl_version_ok &&
 		    defined $stat &&
_

Patches currently in -mm which might be from joe@perches.com are

checkpatch-prefer-strscpy-to-strlcpy.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-23 20:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 20:37 + checkpatch-prefer-strscpy-to-strlcpy.patch added to -mm tree akpm

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 NNTP newsgroup(s).