Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423207AbbD2NiN (ORCPT ); Wed, 29 Apr 2015 09:38:13 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:37787 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423043AbbD2NiJ (ORCPT ); Wed, 29 Apr 2015 09:38:09 -0400 From: Nicolas Schichan To: Russell King , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Nicolas Schichan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] ARM: net fix emit_udiv() for BPF_ALU | BPF_DIV | BPF_K intruction. Date: Wed, 29 Apr 2015 15:37:37 +0200 Message-Id: <1430314657-2552-5-git-send-email-nschichan@freebox.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430314657-2552-1-git-send-email-nschichan@freebox.fr> References: <1430314657-2552-1-git-send-email-nschichan@freebox.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1169 Lines: 35 In that case, emit_udiv() will be called with rn == ARM_R0 (r_scratch) and loading rm first into ARM_R0 will result in jit_udiv() function being called the same dividend and divisor. Fix that by loading rn first into ARM_R1 and then rm into ARM_R0. Signed-off-by: Nicolas Schichan --- arch/arm/net/bpf_jit_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index b5f470d..ffaf311 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c @@ -449,10 +449,10 @@ static inline void emit_udiv(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx) return; } #endif - if (rm != ARM_R0) - emit(ARM_MOV_R(ARM_R0, rm), ctx); if (rn != ARM_R1) emit(ARM_MOV_R(ARM_R1, rn), ctx); + if (rm != ARM_R0) + emit(ARM_MOV_R(ARM_R0, rm), ctx); ctx->seen |= SEEN_CALL; emit_mov_i(ARM_R3, (u32)jit_udiv, ctx); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/