lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1655711942-6181-1-git-send-email-yangtiezhu@loongson.cn>
Date:   Mon, 20 Jun 2022 15:59:02 +0800
From:   Tiezhu Yang <yangtiezhu@...ngson.cn>
To:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>
Cc:     Pavel Machek <pavel@....cz>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH bpf-next] libbpf: Include linux/log2.h to use is_pow_of_2()

is_pow_of_2() is already defined in tools/include/linux/log2.h [1],
so no need to define it again in tools/lib/bpf/libbpf_internal.h,
just include linux/log2.h directly.

[1] https://lore.kernel.org/bpf/20220619171248.GC3362@bug/

Suggested-by: Pavel Machek <pavel@....cz>
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
 tools/lib/bpf/libbpf_internal.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
index a1ad145..021946a 100644
--- a/tools/lib/bpf/libbpf_internal.h
+++ b/tools/lib/bpf/libbpf_internal.h
@@ -13,6 +13,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <linux/err.h>
+#include <linux/log2.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include "libbpf_legacy.h"
@@ -582,9 +583,4 @@ struct bpf_link * usdt_manager_attach_usdt(struct usdt_manager *man,
 					   const char *usdt_provider, const char *usdt_name,
 					   __u64 usdt_cookie);
 
-static inline bool is_pow_of_2(size_t x)
-{
-	return x && (x & (x - 1)) == 0;
-}
-
 #endif /* __LIBBPF_LIBBPF_INTERNAL_H */
-- 
2.1.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ