Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965179AbbLGPgj (ORCPT ); Mon, 7 Dec 2015 10:36:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60680 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964898AbbLGPF0 (ORCPT ); Mon, 7 Dec 2015 10:05:26 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hogan , Ralf Baechle , Paolo Bonzini , Gleb Natapov , linux-mips@linux-mips.org, kvm@vger.kernel.org Subject: [PATCH 4.3 035/125] MIPS: KVM: Fix CACHE immediate offset sign extension Date: Mon, 7 Dec 2015 10:00:48 -0500 Message-Id: <20151207145754.021437136@linuxfoundation.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <20151207145752.225938417@linuxfoundation.org> References: <20151207145752.225938417@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1416 Lines: 44 4.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Hogan commit c5c2a3b998f1ff5a586f9d37e154070b8d550d17 upstream. The immediate field of the CACHE instruction is signed, so ensure that it gets sign extended by casting it to an int16_t rather than just masking the low 16 bits. Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.") Signed-off-by: James Hogan Cc: Ralf Baechle Cc: Paolo Bonzini Cc: Gleb Natapov Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/mips/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c @@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_c base = (inst >> 21) & 0x1f; op_inst = (inst >> 16) & 0x1f; - offset = inst & 0xffff; + offset = (int16_t)inst; cache = (inst >> 16) & 0x3; op = (inst >> 18) & 0x7; -- 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/