Skip to contentSkip to conversation

net: airoha: Avoid -Wflex-array-member-not-at-end warning

PATCH Applied Gustavo A. R. Silva 4 participants 4 messages Sep 22, 2025 – Sep 24, 2025

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

PATCH 1/1 net: airoha: 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 to the end of the corresponding structure. Notice that struct airoha_foe_entry is a flexible structure, this is a structure that contains a flexible-array member.

Fix the following warning:

drivers/net/ethernet/airoha/airoha_eth.h:474:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/net/ethernet/airoha/airoha_eth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_eth.h +3 -1
index 77fd13d466dc..cd13c1c1224f 100644
@@ -471,7 +471,6 @@ struct airoha_flow_table_entry {
 		};
 	};
 
-	struct airoha_foe_entry data;
 	struct hlist_node l2_subflow_node; /* PPE L2 subflow entry */
 	u32 hash;
 
@@ -480,6 +479,9 @@ struct airoha_flow_table_entry {
 
 	struct rhash_head node;
 	unsigned long cookie;
+
+	/* Must be last --ends in a flexible-array member. */
+	struct airoha_foe_entry data;
 };
 
 struct airoha_wdma_info {
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 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 to the end of the corresponding structure. Notice that struct airoha_foe_entry is a flexible structure, this is a structure that contains a flexible-array member.

Fix the following warning:

drivers/net/ethernet/airoha/airoha_eth.h:474:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

FWIIW, I was able to reproduce this locally.
And it goes away with this patch applied.

Quoted 5 lines
---
 drivers/net/ethernet/airoha/airoha_eth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

...

#2 lore raw
Quoted 17 lines · Simon Horman
Quoted 11 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 to the end of the corresponding structure. Notice that struct airoha_foe_entry is a flexible structure, this is a structure that contains a flexible-array member.

Fix the following warning:

drivers/net/ethernet/airoha/airoha_eth.h:474:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

FWIIW, I was able to reproduce this locally.
And it goes away with this patch applied.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines
---
  drivers/net/ethernet/airoha/airoha_eth.h | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Thank you!

-Gustavo

#3 lore raw
In reply to Gustavo A. R. Silva
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 9 lines · On Mon, 22 Sep 2025 16:08:21 +0200 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 corresponding structure. Notice that struct airoha_foe_entry is a flexible structure, this is a structure that contains a flexible-array member.

[...]

Here is the summary with links:
- [next] net: airoha: Avoid -Wflex-array-member-not-at-end warning

    https://git.kernel.org/netdev/net-next/c/09630ab91d84

You are awesome, thank you!

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