From: sashiko-bot@kernel.org
To: "Bence Csokas" <bence.csokas@arm.com>
Cc: linux-rdma@vger.kernel.org, bpf@vger.kernel.org,
linux-security-module@vger.kernel.org,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-hyperv@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-sound@vger.kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH 3/3] treewide: Use offsetofp()
Date: Thu, 05 Nov 2026 17:32:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-199628@kernel.org> (raw)
In-Reply-To: <20261105-offsetof-v1-3-4153f5c10edc@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] treewide: offsetofp() duplicates existing struct_offset() helper
--
commit d78220885af6984fafc359340778dba58aea1b73
Author: Bence Csokas <bence.csokas@arm.com>
treewide: Use offsetofp()
This commit converts treewide uses of offsetof(typeof(*ptr), member) to the
newly introduced offsetofp(ptr, member) macro via Coccinelle.
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 2365a6d8ca15f..83c204458d409 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -108,7 +108,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int max_fences)
> return NULL;
>
> /* Given the resulting bucket size, recalculated max_fences. */
> - list->max_fences = (size - offsetof(typeof(*list), table)) /
> + list->max_fences = (size - offsetofp(list, table)) /
> sizeof(*list->table);
[Severity: Low]
This isn't a bug, but include/linux/overflow.h already provides
struct_offset() with the exact same definition (introduced in commit
f6ed9c5d3190 ("overflow: Introduce struct_offset() to get offset of
member")):
#define struct_offset(p, member) (offsetof(typeof(*(p)), member))
While include/linux/stddef.h now defines:
#define offsetofp(P, MEMBER) offsetof(typeof(*(P)), MEMBER)
For example, dma_resv_list_alloc() in drivers/dma-buf/dma-resv.c already
uses struct_size(list, table, max_fences) from include/linux/overflow.h just
a few lines above.
Could these conversions across the 39 modified files reuse struct_offset(),
or should struct_offset() and offsetofp() be consolidated instead of keeping
two identical macros?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-offsetof-v1-0-4153f5c10edc@arm.com?part=3
prev parent reply other threads:[~2026-11-05 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 17:16 [PATCH 0/3] Add offsetofp() and offsetofendp() for pointer arithmetic Bence Csokas
2026-11-05 17:16 ` [PATCH 1/3] stddef: " Bence Csokas
2026-11-05 17:25 ` sashiko-bot
2026-11-05 17:16 ` [PATCH 2/3] treewide: Use offsetofendp() Bence Csokas
2026-11-05 17:27 ` sashiko-bot
2026-11-05 17:16 ` [PATCH 3/3] treewide: Use offsetofp() Bence Csokas
2026-11-05 17:32 ` sashiko-bot [this message]
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-199628@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