* [PATCH v2 0/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
@ 2025-09-22 6:22 Chenghao Duan
2025-09-22 6:22 ` [PATCH v2 1/1] " Chenghao Duan
2025-10-09 1:06 ` [PATCH v2 0/1] " patchwork-bot+linux-riscv
0 siblings, 2 replies; 4+ messages in thread
From: Chenghao Duan @ 2025-09-22 6:22 UTC (permalink / raw)
To: ast, daniel, andrii, bjorn, pulehui, puranjay, paul.walmsley,
palmer, aou
Cc: martin.lau, eddyz87, song, yonghong.song, john.fastabend, kpsingh,
sdf, haoluo, jolsa, alex, bpf, linux-riscv, linux-kernel,
duanchenghao
v2:
Adjust the commit log
URL for version v1:
https://lore.kernel.org/all/20250820062520.846720-1-duanchenghao@kylinos.cn/
Chenghao Duan (1):
riscv: bpf: Fix uninitialized symbol 'retval_off'
arch/riscv/net/bpf_jit_comp64.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
2025-09-22 6:22 [PATCH v2 0/1] riscv: bpf: Fix uninitialized symbol 'retval_off' Chenghao Duan
@ 2025-09-22 6:22 ` Chenghao Duan
2025-09-23 7:34 ` Pu Lehui
2025-10-09 1:06 ` [PATCH v2 0/1] " patchwork-bot+linux-riscv
1 sibling, 1 reply; 4+ messages in thread
From: Chenghao Duan @ 2025-09-22 6:22 UTC (permalink / raw)
To: ast, daniel, andrii, bjorn, pulehui, puranjay, paul.walmsley,
palmer, aou
Cc: martin.lau, eddyz87, song, yonghong.song, john.fastabend, kpsingh,
sdf, haoluo, jolsa, alex, bpf, linux-riscv, linux-kernel,
duanchenghao
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;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
2025-09-22 6:22 ` [PATCH v2 1/1] " Chenghao Duan
@ 2025-09-23 7:34 ` Pu Lehui
0 siblings, 0 replies; 4+ messages in thread
From: Pu Lehui @ 2025-09-23 7:34 UTC (permalink / raw)
To: Chenghao Duan, ast, daniel, andrii, bjorn, puranjay,
paul.walmsley, palmer, aou
Cc: martin.lau, eddyz87, song, yonghong.song, john.fastabend, kpsingh,
sdf, haoluo, jolsa, alex, bpf, linux-riscv, linux-kernel
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
2025-09-22 6:22 [PATCH v2 0/1] riscv: bpf: Fix uninitialized symbol 'retval_off' Chenghao Duan
2025-09-22 6:22 ` [PATCH v2 1/1] " Chenghao Duan
@ 2025-10-09 1:06 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-10-09 1:06 UTC (permalink / raw)
To: Chenghao Duan
Cc: linux-riscv, ast, daniel, andrii, bjorn, pulehui, puranjay,
paul.walmsley, palmer, aou, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, alex,
bpf, linux-kernel
Hello:
This patch was applied to riscv/linux.git (for-next)
by Alexei Starovoitov <ast@kernel.org>:
On Mon, 22 Sep 2025 14:22:43 +0800 you wrote:
> v2:
> Adjust the commit log
>
> URL for version v1:
> https://lore.kernel.org/all/20250820062520.846720-1-duanchenghao@kylinos.cn/
>
> Chenghao Duan (1):
> riscv: bpf: Fix uninitialized symbol 'retval_off'
>
> [...]
Here is the summary with links:
- [v2,1/1] riscv: bpf: Fix uninitialized symbol 'retval_off'
https://git.kernel.org/riscv/c/d0bf7cd5df18
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-09 1:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22 6:22 [PATCH v2 0/1] riscv: bpf: Fix uninitialized symbol 'retval_off' Chenghao Duan
2025-09-22 6:22 ` [PATCH v2 1/1] " Chenghao Duan
2025-09-23 7:34 ` Pu Lehui
2025-10-09 1:06 ` [PATCH v2 0/1] " patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox