[RFC PATCH v1 2/3] do not merge: Temporary fix for is_power_of_2.

From: Francis Laniel
Date: Wed Aug 10 2022 - 13:19:52 EST


Signed-off-by: Francis Laniel <flaniel@xxxxxxxxxxxxxxxxxxx>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e89cc9c885b3..5d0e997c85ea 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4945,7 +4945,7 @@ static void bpf_map__destroy(struct bpf_map *map);

static bool is_pow_of_2(size_t x)
{
- return x && (x & (x - 1));
+ return x && (x & (x - 1)) == 0;
}

static size_t adjust_ringbuf_sz(size_t sz)
--
2.25.1