summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-04-16 20:47:17 +0200
committerAlexei Starovoitov <ast@kernel.org>2019-04-17 04:44:19 +0200
commite1d1dc4653ecdea55cb0e96844f88da62c65cd4f (patch)
tree712868efc5cad0a0d7915f03f0bb2a4a78049b20 /tools
parentbpf: use BPF_CAST_CALL for casting bpf call (diff)
downloadlinux-e1d1dc4653ecdea55cb0e96844f88da62c65cd4f.tar.xz
linux-e1d1dc4653ecdea55cb0e96844f88da62c65cd4f.zip
libbpf: fix printf formatter for ptrdiff_t argument
Using %ld for printing out value of ptrdiff_t type is not portable between 32-bit and 64-bit archs. This is causing compilation errors for libbpf on 32-bit platform (discovered as part of an effort to integrate libbpf into systemd ([0])). Proper formatter is %td, which is used in this patch. v2->v1: - add Reported-by - provide more context on how this issue was discovered [0] https://github.com/systemd/systemd/pull/12151 Reported-by: Evgeny Vereshchagin <evvers@ya.ru> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Alexei Starovoitov <ast@fb.com> Cc: Yonghong Song <yhs@fb.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/libbpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e5b77ad97795..d817bf20f3d6 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -817,7 +817,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, struct bpf_map *map,
memcpy(*data_buff, data->d_buf, data->d_size);
}
- pr_debug("map %ld is \"%s\"\n", map - obj->maps, map->name);
+ pr_debug("map %td is \"%s\"\n", map - obj->maps, map->name);
return 0;
}