diff options
author | Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> | 2021-10-06 01:55:29 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-10-07 19:52:59 +1100 |
commit | 548b762763b885b81850db676258df47c55dd5f9 (patch) | |
tree | b8c911956ddf3c3a172e4a2c52c74b1937004f6c /arch | |
parent | 48164fccdff6d5cc11308126c050bd25a329df25 (diff) | |
download | linux-548b762763b885b81850db676258df47c55dd5f9.tar.gz |
powerpc/bpf ppc32: Fix BPF_SUB when imm == 0x80000000
Special case handling of the smallest 32-bit negative number for BPF_SUB.
Fixes: 51c66ad849a703 ("powerpc/bpf: Implement extended BPF on PPC32")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7135360a0cdf70adedbccf9863128b8daef18764.1633464148.git.naveen.n.rao@linux.vnet.ibm.com
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/net/bpf_jit_comp32.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c index 68dc8a8231de..0da31d41d413 100644 --- a/arch/powerpc/net/bpf_jit_comp32.c +++ b/arch/powerpc/net/bpf_jit_comp32.c @@ -357,7 +357,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * PPC_LI32(_R0, imm); EMIT(PPC_RAW_ADDC(dst_reg, dst_reg, _R0)); } - if (imm >= 0) + if (imm >= 0 || (BPF_OP(code) == BPF_SUB && imm == 0x80000000)) EMIT(PPC_RAW_ADDZE(dst_reg_h, dst_reg_h)); else EMIT(PPC_RAW_ADDME(dst_reg_h, dst_reg_h)); |