[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97c8e410-5482-42cc-85e1-5c22bfd1d192@huawei.com>
Date: Tue, 23 Sep 2025 15:34:35 +0800
From: Pu Lehui <pulehui@...wei.com>
To: Chenghao Duan <duanchenghao@...inos.cn>, <ast@...nel.org>,
<daniel@...earbox.net>, <andrii@...nel.org>, <bjorn@...nel.org>,
<puranjay@...nel.org>, <paul.walmsley@...ive.com>, <palmer@...belt.com>,
<aou@...s.berkeley.edu>
CC: <martin.lau@...ux.dev>, <eddyz87@...il.com>, <song@...nel.org>,
<yonghong.song@...ux.dev>, <john.fastabend@...il.com>, <kpsingh@...nel.org>,
<sdf@...ichev.me>, <haoluo@...gle.com>, <jolsa@...nel.org>, <alex@...ti.fr>,
<bpf@...r.kernel.org>, <linux-riscv@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
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@...inos.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@...wei.com>
Powered by blists - more mailing lists