Skip to content

Commit e8278d4

Browse files
rnavmpe
authored andcommitted
powerpc/bpf ppc32: Fix JMP32_JSET_K
'andi' only takes an unsigned 16-bit value. Correct the imm range used when emitting andi. Fixes: 51c66ad ("powerpc/bpf: Implement extended BPF on PPC32") Signed-off-by: Naveen N. Rao <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/b94489f52831305ec15aca4dd04a3527236be7e8.1633464148.git.naveen.n.rao@linux.vnet.ibm.com
1 parent c9b8da7 commit e8278d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/powerpc/net/bpf_jit_comp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
10751075
break;
10761076
case BPF_JMP32 | BPF_JSET | BPF_K:
10771077
/* andi does not sign-extend the immediate */
1078-
if (imm >= -32768 && imm < 32768) {
1078+
if (imm >= 0 && imm < 32768) {
10791079
/* PPC_ANDI is _only/always_ dot-form */
10801080
EMIT(PPC_RAW_ANDI(_R0, dst_reg, imm));
10811081
} else {

0 commit comments

Comments
 (0)