sched: act_ct: avoid -Wflex-array-member-not-at-end warning
Subsystems (3)
PATCH 1/1 sched: act_ct: 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 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]
--- net/sched/act_ct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sched/act_ct.c +3 -1
@@ -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 = {
Signature · 1 line
2.34.1
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 structure. Notice that
struct zones_ht_keyis 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 <[email protected]>
Jakub Kicinski
maintainerQuoted 6 lines · 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_keyis 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.
Signature · 1 line
pw-bot: cr
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · 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_keyis 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