[NET]: is_power_of_2 in net/core/neighbour.c

Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

vignesh babu and committed by
David S. Miller
c3609d51 26722873

+2 -1
+2 -1
net/core/neighbour.c
··· 33 #include <linux/rtnetlink.h> 34 #include <linux/random.h> 35 #include <linux/string.h> 36 37 #define NEIGH_DEBUG 1 38 ··· 312 313 NEIGH_CACHE_STAT_INC(tbl, hash_grows); 314 315 - BUG_ON(new_entries & (new_entries - 1)); 316 new_hash = neigh_hash_alloc(new_entries); 317 if (!new_hash) 318 return;
··· 33 #include <linux/rtnetlink.h> 34 #include <linux/random.h> 35 #include <linux/string.h> 36 + #include <linux/log2.h> 37 38 #define NEIGH_DEBUG 1 39 ··· 311 312 NEIGH_CACHE_STAT_INC(tbl, hash_grows); 313 314 + BUG_ON(!is_power_of_2(new_entries)); 315 new_hash = neigh_hash_alloc(new_entries); 316 if (!new_hash) 317 return;