summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-17 11:14:26 +0300
committerRadim Krčmář <rkrcmar@redhat.com>2017-07-19 13:35:12 +0200
commitf85c758dbee54cc3612a6e873ef7cecdb66ebee5 (patch)
treeb00f5e6a41ea1daf9a1c61d57b207708b073a1f3 /arch
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff)
downloadlinux-f85c758dbee54cc3612a6e873ef7cecdb66ebee5.tar.bz2
KVM: x86: masking out upper bits
kvm_read_cr3() returns an unsigned long and gfn is a u64. We intended to mask out the bottom 5 bits but because of the type issue we mask the top 32 bits as well. I don't know if this is a real problem, but it causes static checker warnings. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5b8f07889f6a..82a63c59f77b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -597,8 +597,8 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu)
(unsigned long *)&vcpu->arch.regs_avail))
return true;
- gfn = (kvm_read_cr3(vcpu) & ~31u) >> PAGE_SHIFT;
- offset = (kvm_read_cr3(vcpu) & ~31u) & (PAGE_SIZE - 1);
+ gfn = (kvm_read_cr3(vcpu) & ~31ul) >> PAGE_SHIFT;
+ offset = (kvm_read_cr3(vcpu) & ~31ul) & (PAGE_SIZE - 1);
r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
PFERR_USER_MASK | PFERR_WRITE_MASK);
if (r < 0)