* [PATCH] checkpatch: Prefer strscpy to strlcpy
[not found] <20201222155852.54d9393837ec884870ab4c3b@linux-foundation.org>
@ 2020-12-23 3:45 ` Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2020-12-23 3:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Linus Torvalds, Yu Zhao
Prefer strscpy over the deprecated strlcpy function.
Requested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Joe Perches <joe@perches.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 &&
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-23 3:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20201222155852.54d9393837ec884870ab4c3b@linux-foundation.org>
2020-12-23 3:45 ` [PATCH] checkpatch: Prefer strscpy to strlcpy Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®