Message ID | 1626475617-25984-3-git-send-email-alan.maguire@oracle.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | BPF |
Headers | show |
Series | libbpf: BTF typed dump cleanups | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 10 of 10 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 10 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Fri, Jul 16, 2021 at 3:47 PM Alan Maguire <alan.maguire@oracle.com> wrote: > > Andrii reports: > > "ppc64le arch doesn't like the %lld: > > 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." > Quoting me isn't a great commit message by itself, tbh. Reworded. > Reported-by: Andrii Nakryiko <andrii@kernel.org> > Signed-off-by: Alan Maguire <alan.maguire@oracle.com> > --- > tools/lib/bpf/btf_dump.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c > index 814a538..e5fbfb8 100644 > --- a/tools/lib/bpf/btf_dump.c > +++ b/tools/lib/bpf/btf_dump.c > @@ -2011,8 +2011,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; > } > > -- > 1.8.3.1 >
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 814a538..e5fbfb8 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -2011,8 +2011,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; }
Andrii reports: "ppc64le arch doesn't like the %lld: 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." Reported-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> --- tools/lib/bpf/btf_dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)