Reading from the HI register to get the division result is wrong. The quotient is placed in the LO register. Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Daniel Borkmann <dborkman@xxxxxxxxxx> Cc: Alexei Starovoitov <ast@xxxxxxxxxxxx> Cc: netdev@xxxxxxxxxxxxxxx Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx> --- arch/mips/net/bpf_jit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index f7c206404989..5cc92c4590cb 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c @@ -408,7 +408,7 @@ static inline void emit_div(unsigned int dst, unsigned int src, u32 *p = &ctx->target[ctx->idx]; uasm_i_divu(&p, dst, src); p = &ctx->target[ctx->idx + 1]; - uasm_i_mfhi(&p, dst); + uasm_i_mflo(&p, dst); } ctx->idx += 2; /* 2 insts */ } -- 2.0.0