Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8051134imu; Fri, 28 Dec 2018 09:35:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5cYxBi8BbTpQKEkykuoMhDnJjrRUQEFH3duHk+KMTXdprxmeduc5Rtcmi3lq5Uf34Uq706 X-Received: by 2002:a17:902:4324:: with SMTP id i33mr27822923pld.227.1546018539370; Fri, 28 Dec 2018 09:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546018539; cv=none; d=google.com; s=arc-20160816; b=Rt5pxVyO+NfUmDKUae3NK+xwYKQZa1ziILY9rGjBocItGTPuysEqYuRQ1ki1EXwN9j VbEzWCTvWpujfnX9RuZrJEGDhkJYuHC4gotkaJMWLX6qBv7DcYaxPGXkq6xSfY7iUWn9 MJyrf8KDDFq4LQhX6tzWdlmDhF0LmPYRxlpol/1qwqCkpOZIwIuDz347sGuvWa3i85VS odGkwNgU/kP2JkHVtT078g6t9zp4Y5DGUaTcGOCFbb7c2jzbg8nemVfjxIA1MlzOe+Oq i02RDR4zvFsV2iBQ6zjeTk3ZcS5Fm36cRO27+U3pYcXFj/VDlYQdBMO6WzZ1YA92+BqS V2pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=5E9+UT7F9Xit/F5QIDMGy4qEdd+Iu+3ATzO8lJr9Eow=; b=C7P/UjGkodcYFXiKjyHpU8QGqZmfhW1y376SaS5b2J2m5XccBT6kvnOxpUEhz+nHON H9Smsxow4rZ2xutF+zT33ACVokAttGm1M1oeZ6DDLBPCXIqTVGZ5qYqgPyPIOF6+aQRF scEYt6HGJNI+9Y8mhKbzud2mFX9ugoXXsmvX3IFsm9zxTwTzO/7Ly54TinUpoZtK8YD1 tCJc+Y6C1+2Bm53aDfoKuK06qB8jtVrgX7QcuuaxKfeUMlw78RkATwV1ZcikfBHLTGdX mT3w7f3X2+9oT0qIa7SSjuVA5hFQJBi7tcruc5E2IBC9NfqBAnxIghHUDK+2HdhWxY58 suCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si17376248pfc.248.2018.12.28.09.35.20; Fri, 28 Dec 2018 09:35:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729848AbeL1H6V convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Dec 2018 02:58:21 -0500 Received: from mga03.intel.com ([134.134.136.65]:11379 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728448AbeL1H6U (ORCPT ); Fri, 28 Dec 2018 02:58:20 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2018 23:58:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,408,1539673200"; d="scan'208";a="112576441" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 27 Dec 2018 23:58:19 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 27 Dec 2018 23:58:19 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 27 Dec 2018 23:58:19 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.196]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.45]) with mapi id 14.03.0415.000; Fri, 28 Dec 2018 15:58:07 +0800 From: "Kang, Luwei" To: "Gustavo A. R. Silva" , Paolo Bonzini , =?iso-8859-2?Q?Radim_Kr=E8m=E1=F8?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "x86@kernel.org" CC: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Thread-Topic: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Thread-Index: AQHUnVtXgb861OIeZkyh/KHRAVgCWaWTys8Q Date: Fri, 28 Dec 2018 07:58:06 +0000 Message-ID: <82D7661F83C1A047AF7DC287873BF1E172CA5EC6@SHSMSX101.ccr.corp.intel.com> References: <20181226204059.GA11391@embeddedor> In-Reply-To: <20181226204059.GA11391@embeddedor> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjEwYWQ5YTEtNWYxOS00YzE3LThiN2ItZWFiMmNiODk4NmVlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNmsyTUc2V3BlVGV6UTZzSUFjbGtLeTh3UU1CSXdMNElWdGlyS2tRMUJPN20wa2toZXdXRjNVT2dUTStSTEp2cCJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Gustavo A. R. Silva [mailto:gustavo@embeddedor.com] > Sent: Thursday, December 27, 2018 4:41 AM > To: Kang, Luwei ; Paolo Bonzini ; Radim Kr?m?? ; Thomas Gleixner > ; Ingo Molnar ; Borislav Petkov ; H. Peter Anvin ; > x86@kernel.org > Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; Gustavo A. R. Silva > Subject: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg > > ctl_bitmask in pt_desc is of type u64. When an integer like 0xf is being left shifted more than 32 bits, the behavior is undefined. > > Fix this by adding suffix ULL to integer 0xf. > > Addresses-Coverity-ID: 1476095 ("Bad bit shift operation") > Fixes: 6c0f0bba85a0 ("KVM: x86: Introduce a function to initialize the PT configuration") > Signed-off-by: Gustavo A. R. Silva > --- > arch/x86/kvm/vmx/vmx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index cbd55e7aeae5..251c68a74bbe 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -7012,7 +7012,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) > > /* unmask address range configure area */ > for (i = 0; i < vmx->pt_desc.addr_range; i++) > - vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4)); > + vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4)); > } Looks good to me, thanks. Reviewed-by: Luwei Kang > > static void vmx_cpuid_update(struct kvm_vcpu *vcpu) > -- > 2.20.1