mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 13:14:07 +08:00
powerpc/bpf ppc32: Fix JMP32_JSET_K
'andi' only takes an unsigned 16-bit value. Correct the imm range used
when emitting andi.
Fixes: 51c66ad849
("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/b94489f52831305ec15aca4dd04a3527236be7e8.1633464148.git.naveen.n.rao@linux.vnet.ibm.com
This commit is contained in:
parent
c9b8da77f2
commit
e8278d4444
@ -1075,7 +1075,7 @@ cond_branch:
|
||||
break;
|
||||
case BPF_JMP32 | BPF_JSET | BPF_K:
|
||||
/* andi does not sign-extend the immediate */
|
||||
if (imm >= -32768 && imm < 32768) {
|
||||
if (imm >= 0 && imm < 32768) {
|
||||
/* PPC_ANDI is _only/always_ dot-form */
|
||||
EMIT(PPC_RAW_ANDI(_R0, dst_reg, imm));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user