libbpf: fix printf formatter for ptrdiff_t argument
authorAndrii Nakryiko <andriin@fb.com>
Tue, 16 Apr 2019 18:47:17 +0000 (11:47 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 17 Apr 2019 02:44:19 +0000 (19:44 -0700)
commite1d1dc4653ecdea55cb0e96844f88da62c65cd4f
tree712868efc5cad0a0d7915f03f0bb2a4a78049b20
parent0d306c31b2f77391dacdeaad4470c577f2aecc4f
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>
tools/lib/bpf/libbpf.c