Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6952815imu; Thu, 27 Dec 2018 09:24:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Bum7XgugSCVfdPfymrngTPY3kQaunrM669ixPhL5/o/j2f3gN1WC/MHRORfThSkHHSJQ3 X-Received: by 2002:a62:3603:: with SMTP id d3mr25719389pfa.146.1545931456020; Thu, 27 Dec 2018 09:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545931455; cv=none; d=google.com; s=arc-20160816; b=BHOdfCitrZeqjTtVTW3nh51csviLhuOCwHQPG4uu7ver7AVhb/qZVChTAM16kegfi1 fJPnmE/YuhIaWWN2YHLkxc8IWsn6V5+VWSZfCFNOqZ5VMEmP2LQF/1lNooWFKqSeJLg/ m0OkYhCKcrfYc6eDriFViX9c+lUbIB3jndKhh7eGnWxvdPo0XJAK5I8TSvqMwYT9L0Iw JAJl4Dqau9ReciDCElWBh1wIIhDY7REXSz/883QIcxBbABPO95jwluZ0QOPCD4z7drPg Yu2rKIDleLx8LUkFbjJ/dipPX+JnqBZB+A7WhVUKz+yJ+ZlS5LRE+MwwCvXRoKayaB4q RurA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=MtFZUlaxLDSyvzJaUpbdjfmfsZGCpRBm4HVitqGZUy8=; b=hFZeHXrotG42BIZdVpR4fAEM50oumTbFRS0RA7pEgdUKNRtkpMQb7TwN4im3SM0DF/ 4qJ55HZBertRJdybT/3/dohYpwpszNSB/wSoox91d1tjK133LxBriqa12g7iazwFAU8v Azgn9QEFTYV+Psd2axcWDhc2smihOQ9CrFyFvLuanckVWnWUdRd16LGBCPW8JE8/V1Wn lZUp1CDAMpQ7ktw8l402CRyxt8s5W6pMd+qcrQezTTeHasKtCubTTtcjrkpUbzdXg6uI 93qoQfmGXjxX2bSWSET/lQTzxEqWBMd0O2w+IrOW/xcVAdv/7dXehJq2OfF3WefAVVz9 riJQ== 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 t184si25065327pfb.22.2018.12.27.09.23.58; Thu, 27 Dec 2018 09:24:15 -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 S1728551AbeL0DgN (ORCPT + 99 others); Wed, 26 Dec 2018 22:36:13 -0500 Received: from mga01.intel.com ([192.55.52.88]:44755 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726720AbeL0DgN (ORCPT ); Wed, 26 Dec 2018 22:36:13 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 19:36:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,403,1539673200"; d="scan'208";a="112281486" Received: from richard.sh.intel.com (HELO localhost) ([10.239.36.8]) by fmsmga008.fm.intel.com with ESMTP; 26 Dec 2018 19:36:10 -0800 Date: Thu, 27 Dec 2018 11:35:45 +0800 From: Wei Yang To: "Gustavo A. R. Silva" Cc: Luwei Kang , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Message-ID: <20181227033545.GA15607@richard> Reply-To: Wei Yang References: <20181226204059.GA11391@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181226204059.GA11391@embeddedor> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 26, 2018 at 02:40:59PM -0600, Gustavo A. R. Silva wrote: >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 Looks good. Reviewed-by: Wei Yang >--- > 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)); > } > > static void vmx_cpuid_update(struct kvm_vcpu *vcpu) >-- >2.20.1 -- Wei Yang Help you, Help me