LoongArch: BPF: Don't sign extend function return value
[platform/kernel/linux-starfive.git] / arch / loongarch / net / bpf_jit.c
index db9342b..00915fb 100644 (file)
@@ -855,8 +855,6 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
 
        /* function return */
        case BPF_JMP | BPF_EXIT:
-               emit_sext_32(ctx, regmap[BPF_REG_0], true);
-
                if (i == ctx->prog->len - 1)
                        break;
 
@@ -907,14 +905,8 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
                        }
                        break;
                case BPF_DW:
-                       if (is_signed_imm12(off)) {
-                               emit_insn(ctx, ldd, dst, src, off);
-                       } else if (is_signed_imm14(off)) {
-                               emit_insn(ctx, ldptrd, dst, src, off);
-                       } else {
-                               move_imm(ctx, t1, off, is32);
-                               emit_insn(ctx, ldxd, dst, src, t1);
-                       }
+                       move_imm(ctx, t1, off, is32);
+                       emit_insn(ctx, ldxd, dst, src, t1);
                        break;
                }