]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: ipset: Remove unused htable_bits in macro ahash_region
authorZhen Ni <zhen.ni@easystack.cn>
Fri, 29 Aug 2025 08:36:21 +0000 (16:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:33 +0000 (11:56 +0200)
[ Upstream commit ba941796d7cd1e81f51eed145dad1b47240ff420 ]

Since the ahash_region() macro was redefined to calculate the region
index solely from HTABLE_REGION_BITS, the htable_bits parameter became
unused.

Remove the unused htable_bits argument and its call sites, simplifying
the code without changing semantics.

Fixes: 8478a729c046 ("netfilter: ipset: fix region locking in hash types")
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Reviewed-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/ipset/ip_set_hash_gen.h

index 0bd6bf46f05f3eb4182b6d867bbd90b3dd4db92a..1f9ca5040982d9988a94dbee821654c42cf6701c 100644 (file)
@@ -62,7 +62,7 @@ struct hbucket {
                : jhash_size((htable_bits) - HTABLE_REGION_BITS))
 #define ahash_sizeof_regions(htable_bits)              \
        (ahash_numof_locks(htable_bits) * sizeof(struct ip_set_region))
-#define ahash_region(n, htable_bits)           \
+#define ahash_region(n)                \
        ((n) / jhash_size(HTABLE_REGION_BITS))
 #define ahash_bucket_start(h,  htable_bits)    \
        ((htable_bits) < HTABLE_REGION_BITS ? 0 \
@@ -689,7 +689,7 @@ retry:
 #endif
                                key = HKEY(data, h->initval, htable_bits);
                                m = __ipset_dereference(hbucket(t, key));
-                               nr = ahash_region(key, htable_bits);
+                               nr = ahash_region(key);
                                if (!m) {
                                        m = kzalloc(sizeof(*m) +
                                            AHASH_INIT_SIZE * dsize,
@@ -839,7 +839,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
        rcu_read_lock_bh();
        t = rcu_dereference_bh(h->table);
        key = HKEY(value, h->initval, t->htable_bits);
-       r = ahash_region(key, t->htable_bits);
+       r = ahash_region(key);
        atomic_inc(&t->uref);
        elements = t->hregion[r].elements;
        maxelem = t->maxelem;
@@ -1037,7 +1037,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
        rcu_read_lock_bh();
        t = rcu_dereference_bh(h->table);
        key = HKEY(value, h->initval, t->htable_bits);
-       r = ahash_region(key, t->htable_bits);
+       r = ahash_region(key);
        atomic_inc(&t->uref);
        rcu_read_unlock_bh();