From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yang Subject: Re: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Date: Thu, 27 Dec 2018 11:35:45 +0800 Message-ID: <20181227033545.GA15607@richard> References: <20181226204059.GA11391@embeddedor> Reply-To: Wei Yang Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 To: "Gustavo A. R. Silva" Return-path: Content-Disposition: inline In-Reply-To: <20181226204059.GA11391@embeddedor> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.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