Skip to contentSkip to conversation

wifi: iwlwifi: mei: Remove unused flexible-array member in struct iwl_sap_hdr?

RFC Gustavo A. R. Silva 2 participants 3 messages Aug 11, 2025 – Aug 27, 2025

lore
Share & tools
lore
#0 lore raw

Hi all,

At first sight, it seems that the flexible-array member payload in the struct below it's not being used:

drivers/net/wireless/intel/iwlwifi/mei/sap.h:
298 /**

299  * struct iwl_sap_hdr - prefixes any SAP message
300  * @type: See &enum iwl_sap_msg.
301  * @len: The length of the message (header not included).
302  * @seq_num: For debug.
303  * @payload: The payload of the message.
304  */
305 struct iwl_sap_hdr {
306         __le16 type;
307         __le16 len;
308         __le32 seq_num;
309         u8 payload[];

310 };

If we remove it, we'd get rid of 14 of the following type of warnings:

drivers/net/wireless/intel/iwlwifi/mei/sap.h:318:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Is there any case where this array is actually used that I might be missing?

Thanks!
-Gustavo

#1 lore raw
Quoted 20 lines · Gustavo A. R. Silva

Hi all,

At first sight, it seems that the flexible-array member payload in the struct below it's not being used:

drivers/net/wireless/intel/iwlwifi/mei/sap.h:
298 /**

299  * struct iwl_sap_hdr - prefixes any SAP message
300  * @type: See &enum iwl_sap_msg.
301  * @len: The length of the message (header not included).
302  * @seq_num: For debug.
303  * @payload: The payload of the message.
304  */
305 struct iwl_sap_hdr {
306         __le16 type;
307         __le16 len;
308         __le32 seq_num;
309         u8 payload[];

310 };

Quoted 7 lines

If we remove it, we'd get rid of 14 of the following type of warnings:

drivers/net/wireless/intel/iwlwifi/mei/sap.h:318:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Is there any case where this array is actually used that I might be missing?

Check if it builds? But I don't see it used in our internal (and possibly more recent) version of this either.

johannes

#2 lore raw
Quoted 23 lines · Johannes Berg
Quoted 22 lines · Gustavo A. R. Silva

Hi all,

At first sight, it seems that the flexible-array member payload in the struct below it's not being used:

drivers/net/wireless/intel/iwlwifi/mei/sap.h:
298 /**

299  * struct iwl_sap_hdr - prefixes any SAP message
300  * @type: See &enum iwl_sap_msg.
301  * @len: The length of the message (header not included).
302  * @seq_num: For debug.
303  * @payload: The payload of the message.
304  */
305 struct iwl_sap_hdr {
306         __le16 type;
307         __le16 len;
308         __le32 seq_num;
309         u8 payload[];

310 };

If we remove it, we'd get rid of 14 of the following type of warnings:

Quoted 8 lines
Quoted 5 lines

drivers/net/wireless/intel/iwlwifi/mei/sap.h:318:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Is there any case where this array is actually used that I might be missing?

Check if it builds? But I don't see it used in our internal (and possibly more recent) version of this either.

It seems that the whole thing is actually broken, see commit 8997f5c8a627 ("wifi: iwlwifi: Mark IWLMEI as broken").

However, nothing complains when built without that array. So, I've just submitted a patch.

Thanks!
-Gustavo