mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 23:24:50 +00:00
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>
This commit is contained in:
parent
5771a8c088
commit
f85c758dbe
1 changed files with 2 additions and 2 deletions
|
@ -597,8 +597,8 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu)
|
||||||
(unsigned long *)&vcpu->arch.regs_avail))
|
(unsigned long *)&vcpu->arch.regs_avail))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
gfn = (kvm_read_cr3(vcpu) & ~31u) >> PAGE_SHIFT;
|
gfn = (kvm_read_cr3(vcpu) & ~31ul) >> PAGE_SHIFT;
|
||||||
offset = (kvm_read_cr3(vcpu) & ~31u) & (PAGE_SIZE - 1);
|
offset = (kvm_read_cr3(vcpu) & ~31ul) & (PAGE_SIZE - 1);
|
||||||
r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
|
r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
|
||||||
PFERR_USER_MASK | PFERR_WRITE_MASK);
|
PFERR_USER_MASK | PFERR_WRITE_MASK);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
Loading…
Reference in a new issue