Skip to content

Commit 5ab8cb8

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
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: 79ff13e ("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>
1 parent 7ded842 commit 5ab8cb8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/lib/bpf/libbpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,8 +5352,8 @@ bpf_object__create_maps(struct bpf_object *obj)
53525352
goto err_out;
53535353
}
53545354
if (map->def.type == BPF_MAP_TYPE_ARENA) {
5355-
map->mmaped = mmap((void *)map->map_extra, bpf_map_mmap_sz(map),
5356-
PROT_READ | PROT_WRITE,
5355+
map->mmaped = mmap((void *)(long)map->map_extra,
5356+
bpf_map_mmap_sz(map), PROT_READ | PROT_WRITE,
53575357
map->map_extra ? MAP_SHARED | MAP_FIXED : MAP_SHARED,
53585358
map->fd, 0);
53595359
if (map->mmaped == MAP_FAILED) {

0 commit comments

Comments
 (0)