libbpf: Fix compilation warning due to mismatched printf format
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 9 Feb 2022 06:39:09 +0000 (22:39 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 9 Feb 2022 13:33:32 +0000 (14:33 +0100)
On ppc64le architecture __s64 is long int and requires %ld. Cast to
ssize_t and use %zd to avoid architecture-specific specifiers.

Fixes: 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220209063909.1268319-1-andrii@kernel.org
tools/lib/bpf/btf_dump.c

index 55aed9e398c30185e7d223df5f113d8085925ddc..07ebe70d3a309624127870fc1fb59ec20e4f5944 100644 (file)
@@ -1869,7 +1869,8 @@ static int btf_dump_array_data(struct btf_dump *d,
        elem_type = skip_mods_and_typedefs(d->btf, elem_type_id, NULL);
        elem_size = btf__resolve_size(d->btf, elem_type_id);
        if (elem_size <= 0) {
-               pr_warn("unexpected elem size %lld for array type [%u]\n", elem_size, id);
+               pr_warn("unexpected elem size %zd for array type [%u]\n",
+                       (ssize_t)elem_size, id);
                return -EINVAL;
        }