public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning
@ 2025-11-19  8:03 Gustavo A. R. Silva
  2026-01-16  0:27 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2025-11-19  8:03 UTC (permalink / raw)
  To: Jeff Johnson, Kalle Valo
  Cc: linux-wireless, linux-kernel, Gustavo A. R. Silva,
	linux-hardening

-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]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/wireless/ath/ath6kl/wmi.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 3080d82e25cc..0e7810b9372f 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -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 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning
  2025-11-19  8:03 [PATCH][next] ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2026-01-16  0:27 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2026-01-16  0:27 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jeff Johnson, Kalle Valo, linux-wireless, linux-kernel,
	linux-hardening

On Wed, Nov 19, 2025 at 05:03:42PM +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.
> 
> 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]
> 
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/net/wireless/ath/ath6kl/wmi.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
> index 3080d82e25cc..0e7810b9372f 100644
> --- a/drivers/net/wireless/ath/ath6kl/wmi.h
> +++ b/drivers/net/wireless/ath/ath6kl/wmi.h
> @@ -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;

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

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-16  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19  8:03 [PATCH][next] ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2026-01-16  0:27 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox