[<prev] [next>] [day] [month] [year] [list]
Message-ID: <19fe91084890e2c16fe56f960de6c570a93fa99b.camel@perches.com>
Date: Tue, 22 Dec 2020 19:45:43 -0800
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Yu Zhao <yuzhao@...gle.com>
Subject: [PATCH] checkpatch: Prefer strscpy to strlcpy
Prefer strscpy over the deprecated strlcpy function.
Requested-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Joe Perches <joe@...ches.com>
---
scripts/checkpatch.pl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 00085308ed9d..27679cc0ec17 100755
--- a/scripts/checkpatch.pl
+++ b/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 &&
Powered by blists - more mailing lists