Skip to content

Commit b49d089

Browse files
Leo-YanKernel Patches Daemon
authored andcommitted
selftests/bpf: Initialize operation name before use
ASAN reports stack-buffer-overflow due to the uninitialized op_name. Initialize it to fix the issue. Fixes: 054b6c7 ("selftests/bpf: Add verifier log tests for BPF_BTF_LOAD command") Signed-off-by: Leo Yan <leo.yan@arm.com>
1 parent 4471054 commit b49d089

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tools/testing/selftests/bpf/prog_tests/verifier_log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static void verif_btf_log_subtest(bool bad_btf)
317317
res = load_btf(&opts, true);
318318
ASSERT_EQ(res, -ENOSPC, "half_log_fd");
319319
ASSERT_EQ(strlen(logs.buf), 24, "log_fixed_25");
320+
strscpy(op_name, "log_fixed", sizeof(op_name));
320321
ASSERT_STRNEQ(logs.buf, logs.reference, 24, op_name);
321322

322323
/* validate rolling verifier log logic: try all variations of log buf

0 commit comments

Comments
 (0)