From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Petr Pavlu <petr.pavlu@suse.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: "Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] resolve_btfids: Fix the --fatal_warnings exit status
Date: Thu, 8 Oct 2026 09:20:43 -0700 [thread overview]
Message-ID: <6fced0e8-8101-4665-a15e-8adb8615a186@linux.dev> (raw)
In-Reply-To: <20261008-resolve_btfids-warnings-v1-1-0d4e613ffa6e@suse.com>
On 10/8/26 8:03 AM, Petr Pavlu wrote:
> The resolve_btfids --fatal_warnings option is intended to make the tool
> exit with a non-zero status if any warnings are reported. main()
> initializes err to -1 and uses 'goto out' to return this status when
> a sub-operation fails. If no error occurs,
> 'if (!(fatal_warnings && warnings)) err = 0;' modifies the final status
> depending on whether any warnings have been reported.
>
> Commit 522397d05e7d ("resolve_btfids: Change in-place update with raw
> binary output") broke this logic by assigning the return values of newly
> added sub-operations to err. As a result, successful sub-operations
> overwrite the initial err value of -1 with 0, causing the tool to exit
> successfully even when --fatal_warnings is enabled and warnings have been
> reported.
>
> Fix the issue by setting the final value of err unconditionally, so the
> code doesn't depend on its previous value.
>
> Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Thanks!
> ---
> tools/bpf/resolve_btfids/main.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
> index 37d7e7224207..2a93517ca9ec 100644
> --- a/tools/bpf/resolve_btfids/main.c
> +++ b/tools/bpf/resolve_btfids/main.c
> @@ -1842,8 +1842,7 @@ int main(int argc, const char **argv)
> goto out;
> }
>
> - if (!(fatal_warnings && warnings))
> - err = 0;
> + err = fatal_warnings && warnings ? -1 : 0;
> out:
> btf__free(obj.base_btf);
> btf__free(obj.btf);
>
> ---
> base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
> change-id: 20261008-resolve_btfids-warnings-a356edc7a5c6
prev parent reply other threads:[~2026-10-08 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 15:03 Petr Pavlu
2026-10-08 16:20 ` Ihor Solodrai [this message]
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=6fced0e8-8101-4665-a15e-8adb8615a186@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=petr.pavlu@suse.com \
--cc=song@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
--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
all inboxes | Powered by JetHome®