Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3609d51 authored by vignesh babu's avatar vignesh babu Committed by David S. Miller
Browse files

[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: default avatarvignesh babu <vignesh.babu@wipro.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 26722873
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;