netfilter: nft_set_pipapo: don't return bogus extension pointer
Subsystems (2)
Florian Westphal
maintainerPATCH 1/1 netfilter: nft_set_pipapo: don't return bogus extension pointer
Dan Carpenter says:
Commit 17a20e09f086 ("netfilter: nft_set: remove one argument from lookup and update functions") [..] leads to the following Smatch static checker warning:
net/netfilter/nft_set_pipapo_avx2.c:1269 nft_pipapo_avx2_lookup()
error: uninitialized symbol 'ext'.
Fix this by initing ext to NULL and set it only once we've found a match.
Fixes 17a20e09f086 ("netfilter: nft_set: remove one argument from lookup and update functions")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Florian Westphal <[email protected]>
--- net/netfilter/nft_set_pipapo_avx2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/netfilter/nft_set_pipapo_avx2.c +6 -6
@@ -1150,12 +1150,12 @@ nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, const u32 *key) {struct nft_pipapo *priv =nft_set_priv (set); +const struct nft_set_ext *ext =NULL ;struct nft_pipapo_scratch *scratch;u8 genmask =nft_genmask_cur (net);const struct nft_pipapo_match *m;const struct nft_pipapo_field *f;const u8 *rp = (const u8 *)key; -const struct nft_set_ext *ext;unsigned long *res, *fill;bool map_index;int i;
@@ -1246,13 +1246,13 @@ nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, goto out;if (last) { - ext = &f->mt[ret].e->ext; -if (unlikely (nft_set_elem_expired (ext) || - !nft_set_elem_active (ext, genmask))) { - ext =NULL ; +const struct nft_set_ext *e = &f->mt[ret].e->ext; + +if (unlikely (nft_set_elem_expired (e) || + !nft_set_elem_active (e, genmask))) goto next_match; - } + ext = e; goto out; }
Signature · 1 line
2.50.1