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 <[email protected]>

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/[email protected]?part=3

Reply via email to