Skip to content

Commit c550c6f

Browse files
chenhuacaiKernel Patches Daemon
authored andcommitted
LoongArch: BPF: Fix uninitialized symbol 'retval_off'
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: f9b6b41 ("LoongArch: BPF: Add basic bpf trampoline support") Closes: https://lore.kernel.org/r/[email protected]/ Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 568f554 commit c550c6f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/loongarch/net/bpf_jit.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,11 +1504,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
15041504
stack_size += 16;
15051505

15061506
save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
1507-
if (save_ret) {
1508-
/* Save BPF R0 and A0 */
1509-
stack_size += 16;
1510-
retval_off = stack_size;
1511-
}
1507+
if (save_ret)
1508+
stack_size += 16; /* Save BPF R0 and A0 */
1509+
1510+
retval_off = stack_size;
15121511

15131512
/* Room of trampoline frame to store args */
15141513
nargs = m->nr_args;

0 commit comments

Comments
 (0)