Skip to content

Commit 232bb9a

Browse files
fossddKernel Patches Daemon
authored andcommitted
libbpf: avoid possible use of uninitialized mod_len
If not fn_name, mod_len does never get initialized which fails now with gcc15 on Alpine Linux edge: libbpf.c: In function 'find_kernel_btf_id.constprop': libbpf.c:10100:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized] 10100 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libbpf.c:10070:21: note: 'mod_len' was declared here 10070 | int ret, i, mod_len; | ^~~~~~~ Fixes: 8f8a024 ("libbpf: support "module: Function" syntax for tracing programs") Signed-off-by: Achill Gilgenast <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
1 parent 9879802 commit 232bb9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10096,7 +10096,7 @@ static int find_kernel_btf_id(struct bpf_object *obj, const char *attach_name,
1009610096
enum bpf_attach_type attach_type,
1009710097
int *btf_obj_fd, int *btf_type_id)
1009810098
{
10099-
int ret, i, mod_len;
10099+
int ret, i, mod_len = 0;
1010010100
const char *fn_name, *mod_name = NULL;
1010110101

1010210102
fn_name = strchr(attach_name, ':');

0 commit comments

Comments
 (0)