Skip to contentSkip to conversation

iwlegacy: Avoid multiple -Wflex-array-member-not-at-end warnings

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Nov 19, 2025 – Nov 20, 2025 Intel wireless 3945ABG/bg, 4965AGN (iwlegacy)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlegacy: Avoid multiple -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.

Move the conflicting declarations (which in a couple of cases happens to be in a union, so we're moving the entire unions) to the end of the corresponding structures. Notice that struct il_tx_beacon_cmd, struct il4965_tx_resp, and struct il3945_tx_beacon_cmd are flexible structures, this is structures that contain a flexible-array member.

With these changes fix the following warnings:

11 drivers/net/wireless/intel/iwlegacy/common.h:526:11: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] 11 drivers/net/wireless/intel/iwlegacy/commands.h:2667:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] 4 drivers/net/wireless/intel/iwlegacy/3945.h:131:11: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/net/wireless/intel/iwlegacy/3945.h     | 4 +++-
 drivers/net/wireless/intel/iwlegacy/commands.h | 4 +++-
 drivers/net/wireless/intel/iwlegacy/common.h   | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945.h +3 -1
index fb1e33c89d0e..ed63b31fee9a 100644
@@ -123,13 +123,15 @@ enum il3945_antenna {
 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
 
 struct il3945_frame {
+	struct list_head list;
+
+	/* Must be last as it ends in a flexible-array member. */
 	union {
 		struct ieee80211_hdr frame;
 		struct il3945_tx_beacon_cmd beacon;
 		u8 raw[IEEE80211_FRAME_LEN];
 		u8 cmd[360];
 	} u;
-	struct list_head list;
 };
 
 #define SUP_RATE_11A_MAX_NUM_CHANNELS  8
drivers/net/wireless/intel/iwlegacy/commands.h +3 -1
index b61b8f377702..2e665072f6d3 100644
@@ -2664,10 +2664,12 @@ struct il3945_beacon_notif {
 } __packed;
 
 struct il4965_beacon_notif {
-	struct il4965_tx_resp beacon_notify_hdr;
 	__le32 low_tsf;
 	__le32 high_tsf;
 	__le32 ibss_mgr_status;
+
+	/* Must be last as it ends in a flexible-array member. */
+	struct il4965_tx_resp beacon_notify_hdr;
 } __packed;
 
 /*
drivers/net/wireless/intel/iwlegacy/common.h +3 -1
index 4c9836ab11dd..21f1c7702add 100644
@@ -518,13 +518,15 @@ struct il_channel_info {
 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
 
 struct il_frame {
+	struct list_head list;
+
+	/* Must be last as it ends in a flexible-array member. */
 	union {
 		struct ieee80211_hdr frame;
 		struct il_tx_beacon_cmd beacon;
 		u8 raw[IEEE80211_FRAME_LEN];
 		u8 cmd[360];
 	} u;
-	struct list_head list;
 };
 
 enum {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · Gustavo A. R. Silva

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.

Look, I honor your noble goals, but ... it'd be useful if the code actually worked after :)

Quoted 4 lines
drivers/net/wireless/intel/iwlegacy/commands.h +0 -0
@@ -2664,10 +2664,12 @@ struct il3945_beacon_notif {
 } __packed;

drivers/net/wireless/intel/iwlegacy/commands.h struct il3945_beacon_notif { · line 2673

Quoted 10 lines
drivers/net/wireless/intel/iwlegacy/commands.h +3 -1
 
 struct il4965_beacon_notif {
-	struct il4965_tx_resp beacon_notify_hdr;
 	__le32 low_tsf;
 	__le32 high_tsf;
 	__le32 ibss_mgr_status;
+
+	/* Must be last as it ends in a flexible-array member. */
+	struct il4965_tx_resp beacon_notify_hdr;
 } __packed;

You can't just randomly rearrange firmware API. The __packed and __le32 really ought to have given you a hint here.

johannes