Re: [PATCH net-next] netfilter: nf_conntrack: remove the unneed check for *bucket

From: Florian Westphal
Date: Sat Jan 30 2016 - 16:31:12 EST


Weidong Wang <wangweidong1@xxxxxxxxxx> wrote:
> In the 'for(...) {}', the *bucket alwasy < net->ct.htable_size,
> so remove the check
> @@ -1383,14 +1383,12 @@ get_next_corpse(struct net *net, int (*iter)(struct nf_conn *i, void *data),
> lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS];
> local_bh_disable();
> spin_lock(lockp);
> - if (*bucket < net->ct.htable_size) {

AFAIU net->ct.htable_size can shrink between for-test and aquiring
the bucket lockp, so this additional if-test is needed.