Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: ipset: Remove unused htable_bits in macro ahash_region

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>

authored by

Zhen Ni and committed by
Florian Westphal
ba941796 496a6ed8

+4 -4
+4 -4
net/netfilter/ipset/ip_set_hash_gen.h
··· 63 63 : jhash_size((htable_bits) - HTABLE_REGION_BITS)) 64 64 #define ahash_sizeof_regions(htable_bits) \ 65 65 (ahash_numof_locks(htable_bits) * sizeof(struct ip_set_region)) 66 - #define ahash_region(n, htable_bits) \ 66 + #define ahash_region(n) \ 67 67 ((n) / jhash_size(HTABLE_REGION_BITS)) 68 68 #define ahash_bucket_start(h, htable_bits) \ 69 69 ((htable_bits) < HTABLE_REGION_BITS ? 0 \ ··· 702 702 #endif 703 703 key = HKEY(data, h->initval, htable_bits); 704 704 m = __ipset_dereference(hbucket(t, key)); 705 - nr = ahash_region(key, htable_bits); 705 + nr = ahash_region(key); 706 706 if (!m) { 707 707 m = kzalloc(sizeof(*m) + 708 708 AHASH_INIT_SIZE * dsize, ··· 852 852 rcu_read_lock_bh(); 853 853 t = rcu_dereference_bh(h->table); 854 854 key = HKEY(value, h->initval, t->htable_bits); 855 - r = ahash_region(key, t->htable_bits); 855 + r = ahash_region(key); 856 856 atomic_inc(&t->uref); 857 857 elements = t->hregion[r].elements; 858 858 maxelem = t->maxelem; ··· 1050 1050 rcu_read_lock_bh(); 1051 1051 t = rcu_dereference_bh(h->table); 1052 1052 key = HKEY(value, h->initval, t->htable_bits); 1053 - r = ahash_region(key, t->htable_bits); 1053 + r = ahash_region(key); 1054 1054 atomic_inc(&t->uref); 1055 1055 rcu_read_unlock_bh(); 1056 1056