From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>,
Achill Gilgenast <fossdd@pwned.life>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Viktor Malik <vmalik@redhat.com>,
bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH] libbpf: avoid possible use of uninitialized mod_len
Date: Wed, 30 Jul 2025 09:13:32 -0700 [thread overview]
Message-ID: <a74ec917c2e3bf4d756a5ce2745f0f0a2970805a.camel@gmail.com> (raw)
In-Reply-To: <49c6b3ba-7860-4b13-944f-5f503eb201fd@linux.dev>
On Tue, 2025-07-29 at 09:17 -0700, Yonghong Song wrote:
>
> On 7/29/25 2:45 AM, Achill Gilgenast wrote:
> > 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: 8f8a024272f3 ("libbpf: support "module: Function" syntax for tracing programs")
> > Signed-off-by: Achill Gilgenast <fossdd@pwned.life>
>
> The code itself is actually okay. The error is triggered due to'maybe-uninitialized'.
> To silence the compilation error, I think this change is okay.
>
> Acked-by: Yonghong Song <yonghong.song@linux.dev>
I agree with Yonghong, `mod_len` is only read if mod_name != NULL,
meaning that "if (fn_name) { ... mod_name = ...; mod_len = ... }"
block was executed.
Please drop the "Fixes" tag.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
[...]
next prev parent reply other threads:[~2025-07-30 16:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 9:45 [PATCH] libbpf: avoid possible use of uninitialized mod_len Achill Gilgenast
2025-07-29 16:17 ` Yonghong Song
2025-07-30 16:13 ` Eduard Zingerman [this message]
2025-08-01 11:46 ` Achill Gilgenast
2025-08-01 12:04 ` Achill Gilgenast
2025-08-01 15:16 ` Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a74ec917c2e3bf4d756a5ce2745f0f0a2970805a.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=fossdd@pwned.life \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=vmalik@redhat.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox