]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nft_set_pipapo: Store real pointer, adjust later.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Fri, 15 Aug 2025 16:09:35 +0000 (18:09 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 20 Aug 2025 11:52:37 +0000 (13:52 +0200)
commit6aa67d5706f031f24cd486d8df7dc7fddca62b22
tree85c25f4c319ba9404c27170872e282ed23b58a50
parent84c1da7b38d9ad8fadd5b0b76034a41f7761e404
netfilter: nft_set_pipapo: Store real pointer, adjust later.

The struct nft_pipapo_scratch is allocated, then aligned to the required
alignment and difference (in bytes) is then saved in align_off. The
aligned pointer is used later.
While this works, it gets complicated with all the extra checks if
all member before map are larger than the required alignment.

Instead of saving the aligned pointer, just save the returned pointer
and align the map pointer in nft_pipapo_lookup() before using it. The
alignment later on shouldn't be that expensive. With this change, the
align_off can be removed and the pointer can be passed to kfree() as is.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_set_pipapo.c
net/netfilter/nft_set_pipapo.h
net/netfilter/nft_set_pipapo_avx2.c