summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorDavid Michael <fedora.dm0@gmail.com>2022-11-13 15:52:17 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2022-11-14 19:02:32 +0100
commitdfd0afbf151d85411b371e841f62b81ee5d1ca54 (patch)
treeda832ab2db27a623d5bbfc54d034957e5d08aaf5 /tools/lib
parentf12ed9c04804eec4f1819097a0fd0b4800adac2f (diff)
downloadlinux-dfd0afbf151d85411b371e841f62b81ee5d1ca54.tar.bz2
libbpf: Fix uninitialized warning in btf_dump_dump_type_data
GCC 11.3.0 fails to compile btf_dump.c due to the following error, which seems to originate in btf_dump_struct_data where the returned value would be uninitialized if btf_vlen returns zero. btf_dump.c: In function ‘btf_dump_dump_type_data’: btf_dump.c:2363:12: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 2363 | if (err < 0) | ^ Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data") Signed-off-by: David Michael <fedora.dm0@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Stanislav Fomichev <sdf@google.com> Acked-by: Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/bpf/87zgcu60hq.fsf@gmail.com
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/btf_dump.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index 12f7039e0ab2..e9f849d82124 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -1989,7 +1989,7 @@ static int btf_dump_struct_data(struct btf_dump *d,
{
const struct btf_member *m = btf_members(t);
__u16 n = btf_vlen(t);
- int i, err;
+ int i, err = 0;
/* note that we increment depth before calling btf_dump_print() below;
* this is intentional. btf_dump_data_newline() will not print a