From: Vincent Donnefort <vdonnefort@google.com>
To: apw@canonical.com, joe@perches.com, akpm@linux-foundation.org
Cc: dwaipayanray1@gmail.com, elver@google.com,
linux-kernel@vger.kernel.org, vdonnefort@google.com,
kernel-team@android.com
Subject: [PATCH v1] checkpatch: Add context-analysis attributes
Date: Thu, 12 Nov 2026 15:12:03 +0000 [thread overview]
Message-ID: <20261112151203.3129005-1-vdonnefort@google.com> (raw)
Checkpatch doesn't know about the context analysis attributes and
misparses annotated declarations (e.g. mistaking __guarded_by() fields
for extern prototype). Add them to the known attributes list.
Cc: Marco Elver <elver@google.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
---
scripts/checkpatch.pl | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b8b64f720191..5210b4ed25ec 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -526,6 +526,25 @@ our $InitAttributeData = qr{$InitAttributePrefix(?:initdata\b)};
our $InitAttributeConst = qr{$InitAttributePrefix(?:initconst\b)};
our $InitAttributeInit = qr{$InitAttributePrefix(?:init\b)};
our $InitAttribute = qr{$InitAttributeData|$InitAttributeConst|$InitAttributeInit};
+our $ContextAnalysis = qr{
+ __guarded_by\b|
+ __pt_guarded_by\b|
+ __rcu_guarded\b|
+ __must_hold\b|
+ __must_hold_shared\b|
+ __must_not_hold\b|
+ __acquires\b|
+ __acquires_shared\b|
+ __cond_acquires\b|
+ __cond_acquires_shared\b|
+ __releases\b|
+ __releases_shared\b|
+ __cond_releases\b|
+ __no_context_analysis\b|
+ __context_unsafe\b|
+ __acquires_ret\b|
+ __acquires_shared_ret\b
+ }x;
# Notes to $Attribute:
# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
@@ -551,6 +570,7 @@ our $Attribute = qr{
__ro_after_init|
__kprobes|
$InitAttribute|
+ $ContextAnalysis|
__aligned\s*\(.*\)|
____cacheline_aligned|
____cacheline_aligned_in_smp|
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0.567.gdb80ae8cd5-goog
next reply other threads:[~2026-11-12 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 15:12 Vincent Donnefort [this message]
2026-11-12 15:23 ` Marco Elver
2026-11-13 3:32 ` Joe Perches
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=20261112151203.3129005-1-vdonnefort@google.com \
--to=vdonnefort@google.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=elver@google.com \
--cc=joe@perches.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®