Skip to contentSkip to conversation

cxgb4: Avoid a -Wflex-array-member-not-at-end warning

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Feb 4, 2025 – Feb 6, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cxgb4: Avoid a -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 to the end of the structure. Notice that struct ethtool_dump is a flexible structure --a structure that contains a flexible-array member.

Fix the following warning:
./drivers/net/ethernet/chelsio/cxgb4/cxgb4.h:1215:29: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
Changes in v2:
- Update subject and prefix.
- Add RB tag.

v1:
- Link: https://lore.kernel.org/linux-hardening/ZrDx4Jii7XfuOPfC@cute/

 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +4 -3
index c7c2c15a1815..95e6f015a6af 100644
@@ -1211,9 +1211,6 @@ struct adapter {
 	struct timer_list flower_stats_timer;
 	struct work_struct flower_stats_work;
 
-	/* Ethtool Dump */
-	struct ethtool_dump eth_dump;
-
 	/* HMA */
 	struct hma_data hma;
 
@@ -1233,6 +1230,10 @@ struct adapter {
 
 	/* Ethtool n-tuple */
 	struct cxgb4_ethtool_filter *ethtool_filters;
+
+	/* Ethtool Dump */
+	/* Must be last - ends in a flex-array member. */
+	struct ethtool_dump eth_dump;
 };
 
 /* Support for "sched-class" command to allow a TX Scheduling Class to be
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 4 Feb 2025 13:24:31 +1030 you 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 ethtool_dump is a flexible structure --a structure that contains a flexible-array member.

[...]

Here is the summary with links:
- [v2,next] cxgb4: Avoid a -Wflex-array-member-not-at-end warning

    https://git.kernel.org/netdev/net-next/c/863257c29fe9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html