From: Pu Lehui <pulehui@huawei.com>
To: Chenghao Duan <duanchenghao@kylinos.cn>, <ast@kernel.org>,
<daniel@iogearbox.net>, <andrii@kernel.org>, <bjorn@kernel.org>,
<puranjay@kernel.org>, <paul.walmsley@sifive.com>,
<palmer@dabbelt.com>, <aou@eecs.berkeley.edu>
Cc: <martin.lau@linux.dev>, <eddyz87@gmail.com>, <song@kernel.org>,
<yonghong.song@linux.dev>, <john.fastabend@gmail.com>,
<kpsingh@kernel.org>, <sdf@fomichev.me>, <haoluo@google.com>,
<jolsa@kernel.org>, <alex@ghiti.fr>, <bpf@vger.kernel.org>,
<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
Date: Tue, 23 Sep 2025 15:34:35 +0800 [thread overview]
Message-ID: <97c8e410-5482-42cc-85e1-5c22bfd1d192@huawei.com> (raw)
In-Reply-To: <20250922062244.822937-2-duanchenghao@kylinos.cn>
On 2025/9/22 14:22, Chenghao Duan wrote:
> In the __arch_prepare_bpf_trampoline() function, retval_off is only
> meaningful when save_ret is true, so the current logic is correct.
> However, in the original logic, retval_off is only initialized under
> certain conditions; for example, in the fmod_ret logic, the compiler is
> not aware that the flags of the fmod_ret program (prog) have set
> BPF_TRAMP_F_CALL_ORIG, which results in an uninitialized symbol
> compilation warning.
>
> So initialize retval_off unconditionally to fix it.
>
> Signed-off-by: Chenghao Duan <duanchenghao@kylinos.cn>
> ---
> arch/riscv/net/bpf_jit_comp64.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index 9883a55d61b5..8475a8ab5715 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c
> @@ -1079,10 +1079,9 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
> stack_size += 16;
>
> save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
> - if (save_ret) {
> + if (save_ret)
> stack_size += 16; /* Save both A5 (BPF R0) and A0 */
> - retval_off = stack_size;
> - }
> + retval_off = stack_size;
>
> stack_size += nr_arg_slots * 8;
> args_off = stack_size;
Reviewed-by: Pu Lehui <pulehui@huawei.com>
next prev parent reply other threads:[~2025-09-23 7:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 6:22 [PATCH v2 0/1] " Chenghao Duan
2025-09-22 6:22 ` [PATCH v2 1/1] " Chenghao Duan
2025-09-23 7:34 ` Pu Lehui [this message]
2025-10-09 1:06 ` [PATCH v2 0/1] " patchwork-bot+linux-riscv
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=97c8e410-5482-42cc-85e1-5c22bfd1d192@huawei.com \
--to=pulehui@huawei.com \
--cc=alex@ghiti.fr \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=duanchenghao@kylinos.cn \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=martin.lau@linux.dev \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=puranjay@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--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®