All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richardw.yang@linux.intel.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: "Luwei Kang" <luwei.kang@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	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
Date: Thu, 27 Dec 2018 11:35:45 +0800	[thread overview]
Message-ID: <20181227033545.GA15607@richard> (raw)
In-Reply-To: <20181226204059.GA11391@embeddedor>

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 <gustavo@embeddedor.com>

Looks good.

Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>

>---
> 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

  reply	other threads:[~2018-12-27  3:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 20:40 [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Gustavo A. R. Silva
2018-12-27  3:35 ` Wei Yang [this message]
2018-12-28  7:58 ` Kang, Luwei
2019-01-11 13:39 ` Radim Krčmář

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181227033545.GA15607@richard \
    --to=richardw.yang@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=gustavo@embeddedor.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luwei.kang@intel.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.