aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/hashmap.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2020-08-19 01:36:06 +0000
committerAlexei Starovoitov <[email protected]>2020-08-19 01:38:25 +0000
commit85367030a6c7ef3373347cf816c698995074f6f0 (patch)
treeb0f4b19f18ec9d8d64893a4b7a3e4790851185e2 /tools/lib/bpf/hashmap.c
parenttools/bpftool: Remove libbpf_internal.h usage in bpftool (diff)
downloadkernel-85367030a6c7ef3373347cf816c698995074f6f0.tar.gz
kernel-85367030a6c7ef3373347cf816c698995074f6f0.zip
libbpf: Centralize poisoning and poison reallocarray()
Most of libbpf source files already include libbpf_internal.h, so it's a good place to centralize identifier poisoning. So move kernel integer type poisoning there. And also add reallocarray to a poison list to prevent accidental use of it. libbpf_reallocarray() should be used universally instead. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/hashmap.c')
-rw-r--r--tools/lib/bpf/hashmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/hashmap.c b/tools/lib/bpf/hashmap.c
index a405dad068f5..3c20b126d60d 100644
--- a/tools/lib/bpf/hashmap.c
+++ b/tools/lib/bpf/hashmap.c
@@ -15,6 +15,9 @@
/* make sure libbpf doesn't use kernel-only integer typedefs */
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
+/* prevent accidental re-addition of reallocarray() */
+#pragma GCC poison reallocarray
+
/* start with 4 buckets */
#define HASHMAP_MIN_CAP_BITS 2