netfilter: nft_set_pipapo: shrink data structures
authorFlorian Westphal <fw@strlen.de>
Tue, 13 Feb 2024 15:23:39 +0000 (16:23 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 21 Feb 2024 10:57:11 +0000 (11:57 +0100)
commitaac14d516c2b575af20b426fa04129a28d45c287
treea0ce20da0fcae4bc752faf4f1bf342f8f8a5ce15
parent07ace0bbe03b3d8e85869af1dec5e4087b1d57b8
netfilter: nft_set_pipapo: shrink data structures

The set uses a mix of 'int', 'unsigned int', and size_t.

The rule count limit is NFT_PIPAPO_RULE0_MAX, which cannot
exceed INT_MAX (a few helpers use 'int' as return type).

Add a compile-time assertion for this.

Replace size_t usage in structs with unsigned int or u8 where
the stored values are smaller.

Replace signed-int arguments for lengths with 'unsigned int'
where possible.

Last, remove lt_aligned member: its set but never read.

struct nft_pipapo_match 40 bytes -> 32 bytes
struct nft_pipapo_field 56 bytes -> 32 bytes

Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_set_pipapo.c
net/netfilter/nft_set_pipapo.h