Re: [PATCH 5/6] selftests/bpf: Initialize operation name before use

From: Alexei Starovoitov

Date: Tue Mar 24 2026 - 12:01:46 EST


On Mon, Mar 23, 2026 at 11:58 PM Leo Yan <leo.yan@xxxxxxx> wrote:
>
> On Mon, Mar 23, 2026 at 03:52:38PM -0700, Ihor Solodrai wrote:
> > On 3/23/26 8:40 AM, Leo Yan wrote:
> > > 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@xxxxxxx>
> > > ---
> > > tools/testing/selftests/bpf/prog_tests/verifier_log.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/tools/testing/selftests/bpf/prog_tests/verifier_log.c b/tools/testing/selftests/bpf/prog_tests/verifier_log.c
> > > index aaa2854974c0a91cbbb9fc13ae0f966de1bcc818..dcbe2ef995c5b211c2b86b9555c02144e11ee7d6 100644
> > > --- a/tools/testing/selftests/bpf/prog_tests/verifier_log.c
> > > +++ b/tools/testing/selftests/bpf/prog_tests/verifier_log.c
> > > @@ -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");
> > > + snprintf(op_name, sizeof(op_name), "log_fixed");
> >
> > You should use strscpy() here.
>
> Sure, I will change to :
>
> strscpy(op_name, "log_fixed", sizeof(op_name));
>
> > This patch looks very unrelated.
> > Did this surface only after the changes in the makefiles?
>
> Yes. This change fixes ASAN error reported by BPF CI:
>
> https://github.com/kernel-patches/bpf/actions/runs/23239705647/job/67554431963

When you respin please use [PATHC bpf-next v2] subject.
Otherwise CI doesn't run all tests.