diff mbox series

[next] wifi: ath12k: core.h: Avoid -Wflex-array-member-not-at-end warnings

Message ID Z8-Snz86Xfwdlyd7@kspp (mailing list archive)
State New
Delegated to: Jeff Johnson
Headers show
Series [next] wifi: ath12k: core.h: Avoid -Wflex-array-member-not-at-end warnings | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success No Fixes tag
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Gustavo A. R. Silva March 11, 2025, 1:32 a.m. UTC
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the structure. Notice
that `struct ieee80211_chanctx_conf` is a flexible structure --a
structure that contains a flexible-array member.

Fix 30 of the following warnings:

drivers/net/wireless/ath/ath12k/core.h:298:39: 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/ath12k/core.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Kees Cook April 7, 2025, 6:39 p.m. UTC | #1
On Tue, Mar 11, 2025 at 12:02:15PM +1030, 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 to the end of the structure. Notice
> that `struct ieee80211_chanctx_conf` is a flexible structure --a
> structure that contains a flexible-array member.
> 
> Fix 30 of the following warnings:
> 
> drivers/net/wireless/ath/ath12k/core.h:298:39: 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>

Hi, just checking in on this patch. Is some adjustment needed for this
to land?

Thanks!

-Kees

> ---
>  drivers/net/wireless/ath/ath12k/core.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
> index 3fac4f00d383..d6b4c4d2c400 100644
> --- a/drivers/net/wireless/ath/ath12k/core.h
> +++ b/drivers/net/wireless/ath/ath12k/core.h
> @@ -295,7 +295,6 @@ struct ath12k_link_vif {
>  	int txpower;
>  	bool rsnie_present;
>  	bool wpaie_present;
> -	struct ieee80211_chanctx_conf chanctx;
>  	u8 vdev_stats_id;
>  	u32 punct_bitmap;
>  	u8 link_id;
> @@ -303,6 +302,13 @@ struct ath12k_link_vif {
>  	struct ath12k_rekey_data rekey_data;
>  
>  	u8 current_cntdown_counter;
> +
> +	/* Must be last - ends in a flexible-array member.
> +	 *
> +	 * FIXME: Driver should not copy struct ieee80211_chanctx_conf,
> +	 * especially because it has a flexible array. Find a better way.
> +	 */
> +	struct ieee80211_chanctx_conf chanctx;
>  };
>  
>  struct ath12k_vif {
> -- 
> 2.43.0
>
Jeff Johnson April 7, 2025, 6:45 p.m. UTC | #2
On 4/7/2025 11:39 AM, Kees Cook wrote:
> On Tue, Mar 11, 2025 at 12:02:15PM +1030, 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 to the end of the structure. Notice
>> that `struct ieee80211_chanctx_conf` is a flexible structure --a
>> structure that contains a flexible-array member.
>>
>> Fix 30 of the following warnings:
>>
>> drivers/net/wireless/ath/ath12k/core.h:298:39: 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>
> 
> Hi, just checking in on this patch. Is some adjustment needed for this
> to land?
> 
> Thanks!

There is an alternate solution which should land in the next iteration of
linux-next (I just enabled the post-merge-window flow from ath-next)

https://lore.kernel.org/all/20250321-ath12k-dont-put-chanctx-in-arvif-v1-1-c8e93061952b@quicinc.com/

/jeff
Kees Cook April 7, 2025, 8:29 p.m. UTC | #3
On Mon, Apr 07, 2025 at 11:45:15AM -0700, Jeff Johnson wrote:
> On 4/7/2025 11:39 AM, Kees Cook wrote:
> > On Tue, Mar 11, 2025 at 12:02:15PM +1030, 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 to the end of the structure. Notice
> >> that `struct ieee80211_chanctx_conf` is a flexible structure --a
> >> structure that contains a flexible-array member.
> >>
> >> Fix 30 of the following warnings:
> >>
> >> drivers/net/wireless/ath/ath12k/core.h:298:39: 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>
> > 
> > Hi, just checking in on this patch. Is some adjustment needed for this
> > to land?
> > 
> > Thanks!
> 
> There is an alternate solution which should land in the next iteration of
> linux-next (I just enabled the post-merge-window flow from ath-next)
> 
> https://lore.kernel.org/all/20250321-ath12k-dont-put-chanctx-in-arvif-v1-1-c8e93061952b@quicinc.com/

Ah-ha! Thank you! :)

-Kees
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 3fac4f00d383..d6b4c4d2c400 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -295,7 +295,6 @@  struct ath12k_link_vif {
 	int txpower;
 	bool rsnie_present;
 	bool wpaie_present;
-	struct ieee80211_chanctx_conf chanctx;
 	u8 vdev_stats_id;
 	u32 punct_bitmap;
 	u8 link_id;
@@ -303,6 +302,13 @@  struct ath12k_link_vif {
 	struct ath12k_rekey_data rekey_data;
 
 	u8 current_cntdown_counter;
+
+	/* Must be last - ends in a flexible-array member.
+	 *
+	 * FIXME: Driver should not copy struct ieee80211_chanctx_conf,
+	 * especially because it has a flexible array. Find a better way.
+	 */
+	struct ieee80211_chanctx_conf chanctx;
 };
 
 struct ath12k_vif {