bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	bpf@vger.kernel.org, Tiezhu Yang <yangtiezhu@loongson.cn>,
	Hengqi Chen <hengqi.chen@gmail.com>,
	Huacai Chen <chenhuacai@gmail.com>,
	George Guo <guodongtai@kylinos.cn>,
	Chenghao Duan <duanchenghao@kylinos.cn>,
	loongarch@lists.linux.dev, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] LoongArch: BPF: Fix uninitialized symbol 'retval_off'
Date: Tue, 26 Aug 2025 12:41:49 +0300	[thread overview]
Message-ID: <aK2BXe_ADjY0WdAD@stanley.mountain> (raw)
In-Reply-To: <20250819111953.3197428-1-chenhuacai@loongson.cn>

On Tue, Aug 19, 2025 at 07:19:53PM +0800, Huacai Chen wrote:
> In __arch_prepare_bpf_trampoline(), retval_off is meaningful only when
> save_ret is not 0, so the current logic is correct. But it may cause a
> build warning:

We pass uninitialized data to invoke_bpf_prog(), it's just that it isn't
used.

In the kernel, we would say that's not a bug if invoke_bpf_prog() is
inlined.  (The C standard doesn't differentiate between inlined and not
inlined, passing uninitialized variables is always considered undefined
behavior).  UBSan will complain about the uninitialized variable at
runtime as well depending on if it's inlined or not.

It's not marked as an __always_inline function...

regards,
dan carpenter


      parent reply	other threads:[~2025-08-26  9:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 11:19 [PATCH] LoongArch: BPF: Fix uninitialized symbol 'retval_off' Huacai Chen
2025-08-22 18:43 ` Andrii Nakryiko
2025-08-23  4:10   ` Huacai Chen
2025-08-26  7:07 ` Tiezhu Yang
2025-08-26  8:40   ` Huacai Chen
2025-08-26  9:41 ` Dan Carpenter [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=aK2BXe_ADjY0WdAD@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=daniel@iogearbox.net \
    --cc=duanchenghao@kylinos.cn \
    --cc=guodongtai@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=lkp@intel.com \
    --cc=loongarch@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /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;
as well as URLs for NNTP newsgroup(s).