Skip to content

Commit 909d3e3

Browse files
chenhengqichenhuacai
authored andcommitted
LoongArch: BPF: Remove duplicated flags check
The check for (BPF_TRAMP_F_ORIG_STACK | BPF_TRAMP_F_SHARE_IPMODIFY) is duplicated in __arch_prepare_bpf_trampoline(). Remove it. While at it, make sure stack_size and nargs are initialized once. Cc: [email protected] Tested-by: Vincent Li <[email protected]> Signed-off-by: Hengqi Chen <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 7b6c2d1 commit 909d3e3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

arch/loongarch/net/bpf_jit.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
14511451
void *func_addr, u32 flags)
14521452
{
14531453
int i, ret, save_ret;
1454-
int stack_size = 0, nargs = 0;
1454+
int stack_size, nargs;
14551455
int retval_off, args_off, nargs_off, ip_off, run_ctx_off, sreg_off, tcc_ptr_off;
14561456
bool is_struct_ops = flags & BPF_TRAMP_F_INDIRECT;
14571457
void *orig_call = func_addr;
@@ -1460,9 +1460,6 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
14601460
struct bpf_tramp_links *fmod_ret = &tlinks[BPF_TRAMP_MODIFY_RETURN];
14611461
u32 **branches = NULL;
14621462

1463-
if (flags & (BPF_TRAMP_F_ORIG_STACK | BPF_TRAMP_F_SHARE_IPMODIFY))
1464-
return -ENOTSUPP;
1465-
14661463
/*
14671464
* FP + 8 [ RA to parent func ] return address to parent
14681465
* function
@@ -1496,10 +1493,8 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i
14961493
if (flags & (BPF_TRAMP_F_ORIG_STACK | BPF_TRAMP_F_SHARE_IPMODIFY))
14971494
return -ENOTSUPP;
14981495

1499-
stack_size = 0;
1500-
15011496
/* Room of trampoline frame to store return address and frame pointer */
1502-
stack_size += 16;
1497+
stack_size = 16;
15031498

15041499
save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
15051500
if (save_ret)

0 commit comments

Comments
 (0)