Re: [PATCH][next] wifi: mac80211: ieee80211_i: Avoid dozens of -Wflex-array-member-not-at-end warnings
From: Johannes Berg
Date: Fri Oct 25 2024 - 16:15:17 EST
On Fri, 2024-10-25 at 14:10 -0600, 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.
>
> Move the conflicting declaration to the end of the structure and add
> a code comment. Notice that `struct ieee80211_chanctx_conf` is a
> flexible structure --a structure that contains a flexible-array member.
>
> Fix 50 of the following warnings:
>
> net/mac80211/ieee80211_i.h:895:39: 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@xxxxxxxxxx>
> ---
> net/mac80211/ieee80211_i.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index e7815ffeaf30..c65adbdf2166 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -892,9 +892,10 @@ struct ieee80211_chanctx {
> /* temporary data for search algorithm etc. */
> struct ieee80211_chan_req req;
>
> - struct ieee80211_chanctx_conf conf;
> -
> bool radar_detected;
> +
> + /* MUST be last - ends in a flexible-array member. */
> + struct ieee80211_chanctx_conf conf;
> };
Oi. That's not just a warnings problem, that's actually a pretty stupid
bug, this will surely get used and radar_detected will alias stuff that
the driver puts there - at least for drivers using chanctx_data_size,
which is a couple: ath9k, iwlmvm, mt792x, rwt89 and hwsim.
Could you resend with a description that this is a bugfix and
Fixes: bca8bc0399ac ("wifi: mac80211: handle ieee80211_radar_detected() for MLO")
please? Or I can do it myself I guess, but ...
This shouldn't go to next, it should go to 6.12 since that broke it...
johannes