Message ID | 1536417194-20828-1-git-send-email-lirongqing@baidu.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Series | netlink: fix hash::nelems check | expand |
after reconsider, I think we can remove this check directly, since rht_grow_above_max() will be called to check the overflow again in rhashtable_insert_one. and atomic_read(&table->hash.nelems) always compares with unsigned value, will force to switch unsigned, so the hash.nelems overflows can be accepted. -Rong
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b4a29bcc33b9..412437baee63 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -575,8 +575,7 @@ static int netlink_insert(struct sock *sk, u32 portid) goto err; err = -ENOMEM; - if (BITS_PER_LONG > 32 && - unlikely(atomic_read(&table->hash.nelems) >= UINT_MAX)) + if (unlikely(atomic_read(&table->hash.nelems) == INT_MAX)) goto err; nlk_sk(sk)->portid = portid;