]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/bpf: Initialize operation name before use
authorLeo Yan <leo.yan@arm.com>
Tue, 2 Jun 2026 14:47:15 +0000 (15:47 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 15 Jun 2026 00:32:53 +0000 (17:32 -0700)
ASAN reports stack-buffer-overflow due to the uninitialized op_name.

Initialize it to fix the issue.

Fixes: 054b6c7866c7 ("selftests/bpf: Add verifier log tests for BPF_BTF_LOAD command")
Signed-off-by: Leo Yan <leo.yan@arm.com>
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260602-tools_build_fix_zero_init_bpf_only-v2-6-c76e5250ea1c@arm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier_log.c

index c01c0114af1b7476d27885ce380d90400a4bdc89..4542bb586d723b8fda2faf8261066f16102c60c0 100644 (file)
@@ -317,6 +317,7 @@ static void verif_btf_log_subtest(bool bad_btf)
        res = load_btf(&opts, true);
        ASSERT_EQ(res, -ENOSPC, "half_log_fd");
        ASSERT_EQ(strlen(logs.buf), 24, "log_fixed_25");
+       strscpy(op_name, "log_fixed", sizeof(op_name));
        ASSERT_STRNEQ(logs.buf, logs.reference, 24, op_name);
 
        /* validate rolling verifier log logic: try all variations of log buf