Subject: Re: [PATCH][next] net: inet_sock.h: Avoid thousands of -Wflex-array-member-not-at-end warnings

From: Jakub Kicinski <[email-masked]>
Date: Tue, 18 Nov 2025 12:27:17 -0800

On Tue, 18 Nov 2025 13:36:41 +0900 Gustavo A. R. Silva wrote:
> Not sure what you mean by "nasty" and "no clear benefit", but here is an
> alternative. See it as RFC:

Meaning of the words per dictionary definition.

> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/wfamnae-next20251117&id=e0547082214e61b1db0f5068da0daa3d11f992a5
> 
> [PATCH RFC][next] ipv4/inet_sock.h: Avoid thousands of -Wflex-array-member-not-at-end warnings
> 
> Use DEFINE_RAW_FLEX() to avoid thousands of -Wflex-array-member-not-at-end
> warnings.
> 
> Remove fixed-size array char data[40]; from struct ip_options_data, so
> that flexible-array member struct ip_options_rcu::opt.__data[] ends last
> in this (and other) structure(s).
> 
> Compensate for this by using the DEFINE_RAW_FLEX() helper to declare each
> on-stack struct instance that contains struct ip_options_data as a member.

This is much better, thanks!