summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/btf_dump.c
diff options
context:
space:
mode:
authorAlan Maguire <alan.maguire@oracle.com>2021-07-17 01:46:56 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-07-17 03:25:57 +0300
commit04eb4dff6a64d842f7f2c85c7cb1affc5ab3ebc9 (patch)
treea7085abad91cbc811bd7eabed9697b5422c650eb /tools/lib/bpf/btf_dump.c
parent8d44c3578b48d5f605eddcfd6a644e3944455a6b (diff)
downloadlinux-04eb4dff6a64d842f7f2c85c7cb1affc5ab3ebc9.tar.xz
libbpf: Fix compilation errors on ppc64le for btf dump typed data
__s64 can be defined as either long or long long, depending on the architecture. On ppc64le it's defined as long, giving this error: In file included from btf_dump.c:22: btf_dump.c: In function 'btf_dump_type_data_check_overflow': libbpf_internal.h:111:22: error: format '%lld' expects argument of type 'long long int', but argument 3 has type '__s64' {aka 'long int'} [-Werror=format=] 111 | libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \ | ^~~~~~~~~~ libbpf_internal.h:114:27: note: in expansion of macro '__pr' 114 | #define pr_warn(fmt, ...) __pr(LIBBPF_WARN, fmt, ##__VA_ARGS__) | ^~~~ btf_dump.c:1992:3: note: in expansion of macro 'pr_warn' 1992 | pr_warn("unexpected size [%lld] for id [%u]\n", | ^~~~~~~ btf_dump.c:1992:32: note: format string is defined here 1992 | pr_warn("unexpected size [%lld] for id [%u]\n", | ~~~^ | | | long long int | %ld Cast to size_t and use %zu instead. Reported-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/1626475617-25984-3-git-send-email-alan.maguire@oracle.com
Diffstat (limited to 'tools/lib/bpf/btf_dump.c')
-rw-r--r--tools/lib/bpf/btf_dump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index bf5bb4b127ed..aa695ab9b826 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -2009,8 +2009,8 @@ static int btf_dump_type_data_check_overflow(struct btf_dump *d,
__s64 size = btf__resolve_size(d->btf, id);
if (size < 0 || size >= INT_MAX) {
- pr_warn("unexpected size [%lld] for id [%u]\n",
- size, id);
+ pr_warn("unexpected size [%zu] for id [%u]\n",
+ (size_t)size, id);
return -EINVAL;
}