Commit 216203bd authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jakub Kicinski
Browse files

UAPI: net/sched: Use __struct_group() in flex struct tc_u32_sel

Use the `__struct_group()` helper to create a new tagged
`struct tc_u32_sel_hdr`. This structure groups together all the
members of the flexible `struct tc_u32_sel` except the flexible
array. As a result, the array is effectively separated from the
rest of the members without modifying the memory layout of the
flexible structure.

This new tagged struct will be used to fix problematic declarations
of middle-flex-arrays in composite structs[1].

[1] https://git.kernel.org/linus/d88cabfd9abc



Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/e59fe833564ddc5b2cc83056a4c504be887d6193.1723586870.git.gustavoars@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 35c9ffba
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -246,6 +246,8 @@ struct tc_u32_key {
};

struct tc_u32_sel {
	/* New members MUST be added within the __struct_group() macro below. */
	__struct_group(tc_u32_sel_hdr, hdr, /* no attrs */,
		unsigned char		flags;
		unsigned char		offshift;
		unsigned char		nkeys;
@@ -256,6 +258,7 @@ struct tc_u32_sel {

		short			hoff;
		__be32			hmask;
	);
	struct tc_u32_key	keys[];
};