From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbdHHM0O (ORCPT ); Tue, 8 Aug 2017 08:26:14 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:52485 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbdHHMW4 (ORCPT ); Tue, 8 Aug 2017 08:22:56 -0400 From: Matt Redfearn To: Ralf Baechle CC: , Matt Redfearn , Marcin Nowakowski , , Ingo Molnar , Paul Burton Subject: [PATCH v3 2/6] MIPS: microMIPS: Fix detection of addiusp instruction Date: Tue, 8 Aug 2017 13:22:31 +0100 Message-ID: <1502194955-18018-3-git-send-email-matt.redfearn@imgtec.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502194955-18018-1-git-send-email-matt.redfearn@imgtec.com> References: <1502194955-18018-1-git-send-email-matt.redfearn@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.150.130.83] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The addiusp instruction uses the pool16d opcode, with bit 0 of the immediate set. The test for the addiusp opcode erroneously did a logical and of the immediate with mm_addiusp_func, which has value 1, so this test always passes when the immediate is non-zero. Fix the test by replacing the logical and with a bitwise and. Fixes: 34c2f668d0f6 ("MIPS: microMIPS: Add unaligned access support.") Signed-off-by: Matt Redfearn --- Changes in v3: - New patch to fix detection of addiusp instruction Changes in v2: None arch/mips/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 5950ecf469e9..9d38faf01055 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -326,7 +326,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip) */ if (mm_insn_16bit(ip->halfword[1])) { return (ip->mm16_r3_format.opcode == mm_pool16d_op && - ip->mm16_r3_format.simmediate && mm_addiusp_func) || + ip->mm16_r3_format.simmediate & mm_addiusp_func) || (ip->mm16_r5_format.opcode == mm_pool16d_op && ip->mm16_r5_format.rt == 29); } -- 2.7.4