backport-libbpf-Add-NULL-checks-to-bpf_object__prev_map,next_.patch backport-libbpf-Apply-map_set_def_max_entries-for-inner_maps-.patch backport-libbpf-Fix-uninitialized-warning-in-btf_dump_dump_ty.patch Signed-off-by: zhang-mingyi66 <zhangmingyi5@huawei.com>
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From c975797ebecb07934d1399e1595db8e0d55bec04 Mon Sep 17 00:00:00 2001
|
||
From: David Michael <fedora.dm0@gmail.com>
|
||
Date: Sun, 13 Nov 2022 15:52:17 -0500
|
||
Subject: [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
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
|
||
---
|
||
src/btf_dump.c | 2 +-
|
||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
||
diff --git a/src/btf_dump.c b/src/btf_dump.c
|
||
index 12f7039e0..e9f849d82 100644
|
||
--- a/src/btf_dump.c
|
||
+++ b/src/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
|
||
--
|
||
2.33.0
|