From: sashiko-bot@kernel.org
To: "Bence Csokas" <bence.csokas@arm.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-scsi@vger.kernel.org, bpf@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-sound@vger.kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v4 1/2] overflow: Add offsetofend() variant of struct_offset()
Date: Wed, 18 Nov 2026 12:07:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-220875@kernel.org> (raw)
In-Reply-To: <20261118-offsetof-v4-1-95b385c10b22@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] coccinelle: struct_offsetof.cocci requires parentheses around
ptr
--
commit bd704e7223e04b0fb7bb740d9f758d180e12c2d8
Author: Bence Csokas <bence.csokas@arm.com>
overflow: Add offsetofend() variant of struct_offset()
This commit adds the struct_offsetofend() helper macro and a Coccinelle
semantic patch to convert offsetof(typeof(*ptr), member) and
offsetofend(typeof(*ptr), member) calls.
> diff --git a/scripts/coccinelle/api/struct_offsetof.cocci b/scripts/coccinelle/api/struct_offsetof.cocci
> new file mode 100644
> index 0000000000000..5a30647d37872
> --- /dev/null
> +++ b/scripts/coccinelle/api/struct_offsetof.cocci
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/// Use struct_offset() family of macros
> +///
> +// Confidence: High
> +// Options: --no-includes --ignore ./tools/
> +
> +virtual patch
> +
> +@offsetof depends on patch@
> +expression ptr, member;
> +@@
> +- offsetof(typeof(*(ptr)), member)
> ++ struct_offset(ptr, member)
> +@offsetofend depends on patch@
> +expression ptr, member;
> +@@
> +- offsetofend(typeof(*(ptr)), member)
> ++ struct_offsetofend(ptr, member)
[Severity: Low]
Do the inner parentheses in typeof(*(ptr)) prevent these rules from
matching unparenthesized typeof(*ptr) call sites?
In Coccinelle, the paren isomorphism expands E to (E) in one direction,
so matching typeof(*(ptr)) requires explicit parentheses around ptr in
the C source. Writing typeof(*ptr) matches both typeof(*ptr) and
typeof(*(ptr)).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-offsetof-v4-0-95b385c10b22@arm.com?part=1
next prev parent reply other threads:[~2026-11-18 12:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 11:50 [PATCH v4 0/2] Add struct_offsetofend() for pointer arithmetic Bence Csokas
2026-11-18 11:50 ` [PATCH v4 1/2] overflow: Add offsetofend() variant of struct_offset() Bence Csokas
2026-11-18 12:07 ` sashiko-bot [this message]
2026-11-18 11:50 ` [PATCH v4 2/2] treewide: Use struct_offset() Bence Csokas
2026-11-18 11:56 ` sashiko-bot
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=sashiko-outbox-220875@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bence.csokas@arm.com \
--cc=bpf@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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