Skip to content

Commit d0bf7cd

Browse files
Chenghao DuanAlexei Starovoitov
authored andcommitted
riscv: bpf: Fix uninitialized symbol 'retval_off'
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 <[email protected]> Reviewed-by: Pu Lehui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 0d3bf64 commit d0bf7cd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/riscv/net/bpf_jit_comp64.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,9 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
10611061
stack_size += 16;
10621062

10631063
save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
1064-
if (save_ret) {
1064+
if (save_ret)
10651065
stack_size += 16; /* Save both A5 (BPF R0) and A0 */
1066-
retval_off = stack_size;
1067-
}
1066+
retval_off = stack_size;
10681067

10691068
stack_size += nr_arg_slots * 8;
10701069
args_off = stack_size;

0 commit comments

Comments
 (0)