[PATCH v4 1/2] overflow: Add offsetofend() variant of struct_offset()

Bence Csókás bence.csokas at arm.com
Wed Nov 18 12:21:37 UTC 2026


Hi,

On 2026. 11. 18. 13:07, sashiko-bot at kernel.org wrote:
>> + at offsetof depends on patch@
>> +expression ptr, member;
>> +@@
>> +- offsetof(typeof(*(ptr)), member)
>> ++ struct_offset(ptr, member)
>> + at 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)).

It's actually the other way around. In fact, these parentheses were
suggested by Sashiko in the first place!

Bence
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.



More information about the Linux-security-module-archive mailing list