aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-06-08 08:55:21 -0400
committerAvi Kivity <avi@redhat.com>2009-06-10 08:18:16 -0400
commit09f8ca74ae6c2d78b2c7f6c0751ed0cbe815a3d9 (patch)
treefb45101cca1b35798c61fecfc28f590f071f755b /virt/kvm
parentac04527f7947020c5890090b2ac87af4e98d977e (diff)
KVM: Prevent overflow in largepages calculation
If userspace specifies a memory slot that is larger than 8 petabytes, it could overflow the largepages variable. Cc: stable@kernel.org Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5f865ed4c431..e21194566b71 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1087,8 +1087,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
1087 int r; 1087 int r;
1088 gfn_t base_gfn; 1088 gfn_t base_gfn;
1089 unsigned long npages, ugfn; 1089 unsigned long npages, ugfn;
1090 int largepages; 1090 unsigned long largepages, i;
1091 unsigned long i;
1092 struct kvm_memory_slot *memslot; 1091 struct kvm_memory_slot *memslot;
1093 struct kvm_memory_slot old, new; 1092 struct kvm_memory_slot old, new;
1094 1093