From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
Kalle Valo <quic_kvalo@quicinc.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-hardening@vger.kernel.org
Subject: [PATCH v2][next] wifi: ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning
Date: Tue, 17 Feb 2026 14:10:28 +0900 [thread overview]
Message-ID: <aZP4RI-uN2001cBh@kspp> (raw)
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.
struct bss_bias_info is a flexible structure, this is a structure
that contains a flexible-array member (struct bss_bias bss_bias[]).
Since struct roam_ctrl_cmd is defined by hardware, we create the new
struct bss_bias_info_hdr type, and use it to replace the object type
causing trouble in struct roam_ctrl_cmd, namely struct bss_bias_info.
Also, once -fms-extensions is enabled, we can use transparent struct
members in struct bss_bias_info.
Notice that the newly created type does not contain the flex-array
member `bss_bias`, which is the object causing the -Wfamnae warning.
After these changes, the size of struct roam_ctrl_cmd, along
with its member's offsets remain the same, hence the memory layout
doesn't change:
Before changes:
struct roam_ctrl_cmd {
union {
u8 bssid[6]; /* 0 6 */
u8 roam_mode; /* 0 1 */
struct bss_bias_info bss; /* 0 1 */
struct low_rssi_scan_params params; /* 0 8 */
} info; /* 0 8 */
u8 roam_ctrl; /* 8 1 */
/* size: 9, cachelines: 1, members: 2 */
/* last cacheline: 9 bytes */
} __attribute__((__packed__));
After changes:
struct roam_ctrl_cmd {
union {
u8 bssid[6]; /* 0 6 */
u8 roam_mode; /* 0 1 */
struct bss_bias_info_hdr bss; /* 0 1 */
struct low_rssi_scan_params params; /* 0 8 */
} info; /* 0 8 */
u8 roam_ctrl; /* 8 1 */
/* size: 9, cachelines: 1, members: 2 */
/* last cacheline: 9 bytes */
} __attribute__((__packed__));
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>
---
Changes in v2:
- Create new separate struct bss_bias_info_hdr, and use
transparent struct members (in struct bss_bias_info)
instead of rearranging members in struct roam_ctrl_cmd.
- Update subject line - Add 'wifi:' prefix.
v1:
- Link: https://lore.kernel.org/linux-hardening/aR153k4ExCD-QTMq@kspp/
drivers/net/wireless/ath/ath6kl/wmi.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 3080d82e25cc..d2a5c96fc878 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -1635,8 +1635,12 @@ struct bss_bias {
s8 bias;
} __packed;
-struct bss_bias_info {
+struct bss_bias_info_hdr {
u8 num_bss;
+} __packed;
+
+struct bss_bias_info {
+ struct bss_bias_info_hdr;
struct bss_bias bss_bias[];
} __packed;
@@ -1652,7 +1656,7 @@ struct roam_ctrl_cmd {
union {
u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */
u8 roam_mode; /* WMI_SET_ROAM_MODE */
- struct bss_bias_info bss; /* WMI_SET_HOST_BIAS */
+ struct bss_bias_info_hdr bss; /* WMI_SET_HOST_BIAS */
struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS
*/
} __packed info;
--
2.43.0
next reply other threads:[~2026-02-17 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 5:10 Gustavo A. R. Silva [this message]
2026-02-19 0:18 ` [PATCH v2][next] wifi: ath6kl: wmi: Avoid -Wflex-array-member-not-at-end warning Jeff Johnson
2026-02-18 9:38 ` Gustavo A. R. Silva
2026-02-20 23:36 ` Jeff Johnson
2026-02-20 9:54 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZP4RI-uN2001cBh@kspp \
--to=gustavoars@kernel.org \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_kvalo@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox