Skip to contentSkip to conversation

ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Nov 19, 2025 – Jan 16 Atheros ATH6KL wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning

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

Move the conflicting declaration (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct bss_bias_info is a flexible structure, this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/net/wireless/ath/ath6kl/wmi.h:1658:20: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/net/wireless/ath/ath6kl/wmi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/wmi.h +3 -1
index 3080d82e25cc..0e7810b9372f 100644
@@ -1649,6 +1649,9 @@ struct low_rssi_scan_params {
 } __packed;
 
 struct roam_ctrl_cmd {
+	u8 roam_ctrl;
+
+	/* Must be last as it ends in a flexible-array member. */
 	union {
 		u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */
 		u8 roam_mode; /* WMI_SET_ROAM_MODE */
@@ -1656,7 +1659,6 @@ struct roam_ctrl_cmd {
 		struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS
 						     */
 	} __packed info;
-	u8 roam_ctrl;
 } __packed;
 
 struct set_beacon_int_cmd {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 32 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.

Move the conflicting declaration (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct bss_bias_info is a flexible structure, this is a structure that contains a flexible-array member.

With these changes fix the following warning:

drivers/net/wireless/ath/ath6kl/wmi.h:1658:20: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/net/wireless/ath/ath6kl/wmi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/wmi.h +3 -0
index 3080d82e25cc..0e7810b9372f 100644
@@ -1649,6 +1649,9 @@ struct low_rssi_scan_params {
 } __packed;
 
 struct roam_ctrl_cmd {
+	u8 roam_ctrl;
+
+	/* Must be last as it ends in a flexible-array member. */
 	union {
 		u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */
 		u8 roam_mode; /* WMI_SET_ROAM_MODE */

drivers/net/wireless/ath/ath6kl/wmi.h struct roam_ctrl_cmd { · line 1662

Quoted 5 lines
drivers/net/wireless/ath/ath6kl/wmi.h +0 -1
@@ -1656,7 +1659,6 @@ struct roam_ctrl_cmd {
 		struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS
 						     */
 	} __packed info;
-	u8 roam_ctrl;
 } __packed;

It looks like this is a hardware interface, so I don't think roam_ctrl can be moved like that. See ath6kl_wmi_set_roam_lrssi_cmd().

-Kees

Signature · 1 line
Kees Cook