[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250721162437.6691-2-ignacio.pena87@gmail.com>
Date: Mon, 21 Jul 2025 12:24:33 -0400
From: Ignacio Peña <ignacio.pena87@...il.com>
To: Joe Perches <joe@...ches.com>,
Andy Whitcroft <apw@...onical.com>
Cc: Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ignacio Pena <ignacio.pena87@...il.com>
Subject: [PATCH 2/3] checkpatch: enforce 12-char SHA for Fixes tags
The kernel documentation recommends using 12 character SHA-1 hashes
in Fixes tags as the best practice. While 8 characters might be
sufficient for uniqueness in smaller projects, the kernel's large
history makes collisions more likely with shorter hashes.
Change the existing check from "at least 8" to "exactly 12" to
encourage consistency and future-proof practices.
Link: https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Ignacio Pena <ignacio.pena87@...il.com>
---
scripts/checkpatch.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7ccdc774a..204800232 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3242,7 +3242,7 @@ sub process {
my $tag_case = not ($tag eq "Fixes:");
my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
- my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/i);
+ my $id_length = not ($orig_commit =~ /^[0-9a-f]{12}$/i);
my $id_case = not ($orig_commit !~ /[A-F]/);
my $id = "0123456789ab";
@@ -3252,7 +3252,7 @@ sub process {
if (defined($cid) && ($ctitle ne $title || $tag_case || $tag_space || $id_length || $id_case || !$title_has_quotes)) {
my $fixed = "Fixes: $cid (\"$ctitle\")";
if (WARN("BAD_FIXES_TAG",
- "Please use correct Fixes: style 'Fixes: <12+ chars of sha1> (\"<title line>\")' - ie: '$fixed'\n" . $herecurr) &&
+ "Please use correct Fixes: style 'Fixes: <exactly 12 chars of sha1> (\"<title line>\")' - ie: '$fixed'\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] = $fixed;
}
--
2.50.1
Powered by blists - more mailing lists