From patchwork Wed Jun 10 13:23:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 6579891 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57327C0020 for ; Wed, 10 Jun 2015 13:24:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79F6320603 for ; Wed, 10 Jun 2015 13:24:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F042A205FA for ; Wed, 10 Jun 2015 13:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964810AbbFJNYH (ORCPT ); Wed, 10 Jun 2015 09:24:07 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:35559 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933690AbbFJNXu (ORCPT ); Wed, 10 Jun 2015 09:23:50 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1Z2fyt-0006ER-5a; Wed, 10 Jun 2015 15:23:47 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Nicholas Mc Guire , Gleb Natapov , Paolo Bonzini , kvm@vger.kernel.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Ralf Baechle , Jiri Slaby Subject: [patch added to the 3.12 stable tree] MIPS: KVM: Do not sign extend on unsigned MMIO load Date: Wed, 10 Jun 2015 15:23:43 +0200 Message-Id: <1433942626-23822-20-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433942626-23822-1-git-send-email-jslaby@suse.cz> References: <1433942626-23822-1-git-send-email-jslaby@suse.cz> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Mc Guire This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced upstream. Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2. Signed-off-by: Nicholas Mc Guire Reviewed-by: James Hogan Tested-by: James Hogan Cc: Gleb Natapov Cc: Paolo Bonzini Cc: kvm@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/9985/ Signed-off-by: Ralf Baechle Signed-off-by: Jiri Slaby --- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index e75ef8219caf..c76f297b7149 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) if (vcpu->mmio_needed == 2) *gpr = *(int16_t *) run->mmio.data; else - *gpr = *(int16_t *) run->mmio.data; + *gpr = *(uint16_t *)run->mmio.data; break; case 1: