aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng(Eric) Liu <eric.e.liu@intel.com>2008-01-22 18:01:08 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-22 12:05:21 +0200
commit29ae41a859a12aa71baacd35a9648511f335848e (patch)
tree23846e4e1a565760aa41d873ec6d9087e30076a2
parent67704e250e558f937c25fa44b6dd0e4fb9f12341 (diff)
KVM: MMU: Fix gpa truncation when reading a ptekvm-60
Since the type of gpa is u64, so extend pte_size to u64. Otherwise, gpa may be truncated to u32. Signed-off-by: Feng (Eric) Liu <eric.e.liu@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--arch/x86/kvm/mmu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index cb62ef65d0bd..c85b90492743 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1477,7 +1477,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
if ((gpa & (pte_size - 1)) || (bytes < pte_size)) {
gentry = 0;
r = kvm_read_guest_atomic(vcpu->kvm,
- gpa & ~(pte_size - 1),
+ gpa & ~(u64)(pte_size - 1),
&gentry, pte_size);
new = (const void *)&gentry;
if (r < 0)