Use the new TRAILING_OVERLAP() helper to fix 2600 of the following warnings: 2600 ./include/net/inet_sock.h:65:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] This helper creates a union between a flexible-array member (FAM) and a set of members that would otherwise follow it (in this case `char data[40];) This overlays the trailing members (data) onto the FAM (__data) while keeping the FAM and the start of MEMBERS aligned. The static_assert() ensures this alignment remains, and it's intentionally placed inmediately after `struct ip_options_data` (no blank line in between). Signed-off-by: Gustavo A. R. Silva --- I think it's worth mentioning that the introduction of the new TRAILING_OVERLAP() helper saves us from making changes like the following, for this particular case: https://lore.kernel.org/linux-hardening/ZzK-n_C2yl8mW2Tz@kspp/ Thanks include/net/inet_sock.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 1086256549fa..a974588803af 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -62,9 +62,12 @@ struct ip_options_rcu { }; struct ip_options_data { - struct ip_options_rcu opt; - char data[40]; + TRAILING_OVERLAP(struct ip_options_rcu, opt, opt.__data, + char data[40]; + ); }; +static_assert(offsetof(struct ip_options_data, opt.opt.__data) == + offsetof(struct ip_options_data, data)); struct inet_request_sock { struct request_sock req; -- 2.43.0