diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2024-03-19 22:51:43 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-03-20 06:54:04 +0100 |
commit | 5ab8cb89dbb6f3e111c8b0a9a86496da23c94439 (patch) | |
tree | e39824b931c665dba7872599e8d7a3982292e036 /tools | |
parent | s390/bpf: Fix bpf_plt pointer arithmetic (diff) | |
download | linux-5ab8cb89dbb6f3e111c8b0a9a86496da23c94439.tar.xz linux-5ab8cb89dbb6f3e111c8b0a9a86496da23c94439.zip |
libbpf: fix u64-to-pointer cast on 32-bit arches
It's been reported that (void *)map->map_extra is causing compilation
warnings on 32-bit architectures. It's easy enough to fix this by
casting to long first.
Fixes: 79ff13e99169 ("libbpf: Add support for bpf_arena.")
Reported-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Message-ID: <20240319215143.1279312-1-andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/bpf/libbpf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 36e26f4f5997..1e3e697b98bc 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -5352,8 +5352,8 @@ retry: goto err_out; } if (map->def.type == BPF_MAP_TYPE_ARENA) { - map->mmaped = mmap((void *)map->map_extra, bpf_map_mmap_sz(map), - PROT_READ | PROT_WRITE, + map->mmaped = mmap((void *)(long)map->map_extra, + bpf_map_mmap_sz(map), PROT_READ | PROT_WRITE, map->map_extra ? MAP_SHARED | MAP_FIXED : MAP_SHARED, map->fd, 0); if (map->mmaped == MAP_FAILED) { |