* [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning
@ 2024-08-05 15:35 Gustavo A. R. Silva
2024-08-07 16:18 ` Simon Horman
2024-08-09 2:46 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-05 15:35 UTC (permalink / raw)
To: Jamal Hadi Salim, Cong Wang, Jiri Pirko, 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 zones_ht_key` is a flexible structure --a structure that
contains a flexible-array member.
Fix the following warning:
net/sched/act_ct.c:57: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>
---
net/sched/act_ct.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index 3ba8e7e739b5..b304ef46b5be 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -54,9 +54,11 @@ struct tcf_ct_flow_table {
struct rcu_work rwork;
struct nf_flowtable nf_ft;
refcount_t ref;
- struct zones_ht_key key;
bool dying;
+
+ /* Must be last - ends in a flex-array member. */
+ struct zones_ht_key key;
};
static const struct rhashtable_params zones_params = {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning
2024-08-05 15:35 [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2024-08-07 16:18 ` Simon Horman
2024-08-09 2:46 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-08-07 16:18 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
linux-hardening
On Mon, Aug 05, 2024 at 09:35:46AM -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 zones_ht_key` is a flexible structure --a structure that
> contains a flexible-array member.
>
> Fix the following warning:
> net/sched/act_ct.c:57: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] 4+ messages in thread
* Re: [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning
2024-08-05 15:35 [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2024-08-07 16:18 ` Simon Horman
@ 2024-08-09 2:46 ` Jakub Kicinski
2024-08-09 15:21 ` Gustavo A. R. Silva
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2024-08-09 2:46 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller,
Eric Dumazet, Paolo Abeni, netdev, linux-kernel, linux-hardening
On Mon, 5 Aug 2024 09:35:46 -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 zones_ht_key` is a flexible structure --a structure that
> contains a flexible-array member.
I think the flex member is there purely to mark the end of the struct.
You can use offsetofend(zone) instead of offsetof(pad), and delete pad.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning
2024-08-09 2:46 ` Jakub Kicinski
@ 2024-08-09 15:21 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2024-08-09 15:21 UTC (permalink / raw)
To: Jakub Kicinski, Gustavo A. R. Silva
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller,
Eric Dumazet, Paolo Abeni, netdev, linux-kernel, linux-hardening
On 08/08/24 20:46, Jakub Kicinski wrote:
> On Mon, 5 Aug 2024 09:35:46 -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 zones_ht_key` is a flexible structure --a structure that
>> contains a flexible-array member.
>
> I think the flex member is there purely to mark the end of the struct.
> You can use offsetofend(zone) instead of offsetof(pad), and delete pad.
Nice! I'll send v2, shortly.
Thanks
--
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-09 15:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 15:35 [PATCH][next] sched: act_ct: avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2024-08-07 16:18 ` Simon Horman
2024-08-09 2:46 ` Jakub Kicinski
2024-08-09 15:21 ` Gustavo A. R. Silva
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.