Skip to content

Commit 7b6c2d1

Browse files
committed
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. Cc: [email protected] 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 24ff034 commit 7b6c2d1

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
@@ -1502,11 +1502,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
15021502
stack_size += 16;
15031503

15041504
save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
1505-
if (save_ret) {
1506-
/* Save BPF R0 and A0 */
1507-
stack_size += 16;
1508-
retval_off = stack_size;
1509-
}
1505+
if (save_ret)
1506+
stack_size += 16; /* Save BPF R0 and A0 */
1507+
1508+
retval_off = stack_size;
15101509

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

0 commit comments

Comments
 (0)