From f0e150c35aafa7b2f5ac4123a8de918f296de01c Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Tue, 12 Apr 2022 13:12:19 +0200 Subject: [PATCH] util/lint/checkpatch.pl: Add strlcpy check Update to v5.18-2 Signed-off-by: Elyes Haouas Change-Id: Ic4eaa3f26bcd60ea509a52d5715c7ce1f43b6d3d Reviewed-on: https://review.coreboot.org/c/coreboot/+/63581 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/lint/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 1b9a3d4e67..8275daaebf 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -6238,6 +6238,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 &&