From: Hamdy Abou El Anein <info@daylightlinux.ch>
To: nathan@kernel.org, nsc@kernel.org
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rdunlap@infradead.org, breno3011alves@gmail.com
Subject: [PATCH] scripts: checkversion: match complete version macro names
Date: Tue, 1 Dec 2026 23:10:29 +0100 [thread overview]
Message-ID: <20261201221029.16263-1-info@daylightlinux.ch> (raw)
The version macro checks match substrings of unrelated identifiers.
For example, MY_LINUX_VERSION_CODE and KERNEL_VERSION_EXTRA are
mistaken for macros from linux/version.h. Also, the non-word
character required before KERNEL_VERSION prevents detection at the
start of a line.
Use word boundaries around the complete set of version macro names
to avoid these false positives and detect uses at the start of a line.
Tested with all five version macros, longer unrelated identifiers,
a macro at the start of a line, unused and needed includes, and
existing comment and string handling.
AI assistance: ChatGPT identified the issue, prepared the fix and
commit message, and ran local regression tests.
Signed-off-by: Hamdy Abou El Anein <info@daylightlinux.ch>
---
scripts/checkversion.pl | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/checkversion.pl b/scripts/checkversion.pl
index 94cd49eff605..3685f080f69e 100755
--- a/scripts/checkversion.pl
+++ b/scripts/checkversion.pl
@@ -44,9 +44,7 @@ foreach my $file (@ARGV) {
# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION,
# LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL, LINUX_VERSION_SUBLEVEL
- if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) ||
- ($_ =~ /LINUX_VERSION_MAJOR/) || ($_ =~ /LINUX_VERSION_PATCHLEVEL/) ||
- ($_ =~ /LINUX_VERSION_SUBLEVEL/)) {
+ if (m/\b(?:KERNEL_VERSION|LINUX_VERSION_(?:CODE|MAJOR|PATCHLEVEL|SUBLEVEL))\b/) {
$fUseVersion = 1;
last if $iLinuxVersion;
}
--
2.56.1
reply other threads:[~2026-12-01 22:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201221029.16263-1-info@daylightlinux.ch \
--to=info@daylightlinux.ch \
--cc=breno3011alves@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox