bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
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>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] LoongArch: BPF: Fix uninitialized symbol 'retval_off'
Date: Fri, 22 Aug 2025 11:43:19 -0700	[thread overview]
Message-ID: <CAEf4BzajrMOkdOX5fn=bzWVTLbObPM9=_4Nh9rm5oc_4377Pfw@mail.gmail.com> (raw)
In-Reply-To: <20250819111953.3197428-1-chenhuacai@loongson.cn>

On Tue, Aug 19, 2025 at 4:21 AM Huacai Chen <chenhuacai@loongson.cn> 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:
>
> arch/loongarch/net/bpf_jit.c:1547 __arch_prepare_bpf_trampoline() error: uninitialized symbol 'retval_off'.
>
> So initialize retval_off unconditionally to fix it.
>
> Fixes: f9b6b41f0cf3 ("LoongArch: BPF: Add basic bpf trampoline support")
> Closes: https://lore.kernel.org/r/202508191020.PBBh07cK-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  arch/loongarch/net/bpf_jit.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>

Is this something that should go through loongarch-specific tree?

> diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
> index abfdb6bb5c38..a73f6ea4ed4a 100644
> --- a/arch/loongarch/net/bpf_jit.c
> +++ b/arch/loongarch/net/bpf_jit.c
> @@ -1504,11 +1504,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
>         stack_size += 16;
>
>         save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
> -       if (save_ret) {
> -               /* Save BPF R0 and A0 */
> -               stack_size += 16;
> -               retval_off = stack_size;
> -       }
> +       if (save_ret)
> +               stack_size += 16; /* Save BPF R0 and A0 */
> +
> +       retval_off = stack_size;
>
>         /* Room of trampoline frame to store args */
>         nargs = m->nr_args;
> --
> 2.47.3
>
>

  reply	other threads:[~2025-08-22 18:43 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 [this message]
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

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='CAEf4BzajrMOkdOX5fn=bzWVTLbObPM9=_4Nh9rm5oc_4377Pfw@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=dan.carpenter@linaro.org \
    --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).