[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSRoFj1RIHZNPFwm@horms.kernel.org>
Date: Mon, 24 Nov 2025 14:13:42 +0000
From: Simon Horman <horms@...nel.org>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
oss-drivers@...igine.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] nfp: tls: Avoid -Wflex-array-member-not-at-end
warnings
On Thu, Nov 20, 2025 at 11:39:39AM +0900, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> So, in order to avoid ending up with flexible-array members in the
> middle of other structs, we use the `struct_group_tagged()` helper
> to separate the flexible array from the rest of the members in the
> flexible structure. We then use the newly created tagged `struct
> nfp_crypto_req_add_front_hdr` to replace the type of the objects
> causing trouble in a couple of structures.
>
> We also want to ensure that when new members need to be added to the
> flexible structure, they are always included within the newly created
> tagged struct. For this, we use `static_assert()`. This ensures that the
> memory layout for both the flexible structure and the new tagged struct
> is the same after any changes.
>
> Lastly, use container_of() to retrieve a pointer to the flexible
> structure and, through that, access the flexible-array member when
> needed.
>
> So, with these changes, fix the following warnings:
>
> drivers/net/ethernet/netronome/nfp/nfdk/../crypto/fw.h:65:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> drivers/net/ethernet/netronome/nfp/nfdk/../crypto/fw.h:58:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> drivers/net/ethernet/netronome/nfp/nfd3/../crypto/fw.h:58:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
> drivers/net/ethernet/netronome/nfp/nfd3/../crypto/fw.h:65:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Reviewed-by: Simon Horman <horms@...nel.org>
Powered by blists - more mailing lists