]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
libbpf: fix u64-to-pointer cast on 32-bit arches
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 19 Mar 2024 21:51:43 +0000 (14:51 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 20 Mar 2024 05:54:04 +0000 (22:54 -0700)
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>
tools/lib/bpf/libbpf.c

index 36e26f4f5997d1c0e705d5450c1059edc4d67687..1e3e697b98bcaf66c75457e0fdd11b74888e0785 100644 (file)
@@ -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) {