From: Andrii Nakryiko Date: Tue, 9 Jul 2019 04:00:07 +0000 (-0700) Subject: libbpf: fix ptr to u64 conversion warning on 32-bit platforms X-Git-Tag: v5.4-rc1~508^2~7^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36db2a94f19ae1fcf1e6d8253df0c32f90f92860;p=platform%2Fkernel%2Flinux-rpi.git libbpf: fix ptr to u64 conversion warning on 32-bit platforms On 32-bit platforms compiler complains about conversion: libbpf.c: In function ‘perf_event_open_probe’: libbpf.c:4112:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */ ^ Reported-by: Matt Hart Fixes: b26500274767 ("libbpf: add kprobe/uprobe attach API") Tested-by: Matt Hart Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann --- diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index ed07789..794dd50 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -4126,8 +4126,8 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name, } attr.size = sizeof(attr); attr.type = type; - attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */ - attr.config2 = offset; /* kprobe_addr or probe_offset */ + attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */ + attr.config2 = offset; /* kprobe_addr or probe_offset */ /* pid filter is meaningful only for uprobes */ pfd = syscall(__NR_perf_event_open, &attr,