* [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning
@ 2024-08-05 15:38 Gustavo A. R. Silva
2024-08-07 16:26 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-05 15:38 UTC (permalink / raw)
To: Potnuri Bharat Teja, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, 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 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]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index fca9533bc011..996769857a12 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning
2024-08-05 15:38 [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2024-08-07 16:26 ` Simon Horman
2024-08-07 16:44 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2024-08-07 16:26 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Potnuri Bharat Teja, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
linux-hardening
On Mon, Aug 05, 2024 at 09:38:08AM -0600, 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 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]
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning
2024-08-07 16:26 ` Simon Horman
@ 2024-08-07 16:44 ` Simon Horman
0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-08-07 16:44 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Potnuri Bharat Teja, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
linux-hardening
On Wed, Aug 07, 2024 at 05:26:02PM +0100, Simon Horman wrote:
> On Mon, Aug 05, 2024 at 09:38:08AM -0600, 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 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]
> >
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
Sorry, one minor nit, after the fact.
cxgb4 would probably be a better prefix than ethtool for this patch.
But then it would conflict, by name, with
- [PATCH] cxgb4: Avoid -Wflex-array-member-not-at-end warning
https://lore.kernel.org/all/ZrD8vpfiYugd0cPQ@cute/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-07 16:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 15:38 [PATCH][next] ethtool: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2024-08-07 16:26 ` Simon Horman
2024-08-07 16:44 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).