summaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
authorvignesh babu2007-08-25 07:27:55 +0200
committerDavid S. Miller2007-08-27 03:35:37 +0200
commitc3609d510f844100669965db8a9ff10ba029bb4a (patch)
treefb86593f7310805bb6c70cf2b61f4e7b3731d7aa /net/core/neighbour.c
parent[TCP]: Describe tcp_init_cwnd() thoroughly in a comment. (diff)
downloadkernel-qcow2-linux-c3609d510f844100669965db8a9ff10ba029bb4a.tar.gz
kernel-qcow2-linux-c3609d510f844100669965db8a9ff10ba029bb4a.tar.xz
kernel-qcow2-linux-c3609d510f844100669965db8a9ff10ba029bb4a.zip
[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>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index ca2a1533138a..f7de8f24d8dd 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -33,6 +33,7 @@
#include <linux/rtnetlink.h>
#include <linux/random.h>
#include <linux/string.h>
+#include <linux/log2.h>
#define NEIGH_DEBUG 1
@@ -311,7 +312,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)
NEIGH_CACHE_STAT_INC(tbl, hash_grows);
- BUG_ON(new_entries & (new_entries - 1));
+ BUG_ON(!is_power_of_2(new_entries));
new_hash = neigh_hash_alloc(new_entries);
if (!new_hash)
return;