Skip to content

Commit 5612ea8

Browse files
tstellaranakryiko
authored andcommitted
bpftool: Fix -Wuninitialized-const-pointer warnings with clang >= 21
This fixes the build with -Werror -Wall. btf_dumper.c:71:31: error: variable 'finfo' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer] 71 | info.func_info = ptr_to_u64(&finfo); | ^~~~~ prog.c:2294:31: error: variable 'func_info' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer] 2294 | info.func_info = ptr_to_u64(&func_info); | v2: - Initialize instead of using memset. Signed-off-by: Tom Stellard <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 57cb269 commit 5612ea8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/bpf/bpftool/btf_dumper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,
3838
__u32 info_len = sizeof(info);
3939
const char *prog_name = NULL;
4040
struct btf *prog_btf = NULL;
41-
struct bpf_func_info finfo;
41+
struct bpf_func_info finfo = {};
4242
__u32 finfo_rec_size;
4343
char prog_str[1024];
4444
int err;

tools/bpf/bpftool/prog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ static void profile_print_readings(void)
22622262

22632263
static char *profile_target_name(int tgt_fd)
22642264
{
2265-
struct bpf_func_info func_info;
2265+
struct bpf_func_info func_info = {};
22662266
struct bpf_prog_info info = {};
22672267
__u32 info_len = sizeof(info);
22682268
const struct btf_type *t;

0 commit comments

Comments
 (0)