From 09f8ca74ae6c2d78b2c7f6c0751ed0cbe815a3d9 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 8 Jun 2009 15:55:21 +0300 Subject: 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 --- virt/kvm/kvm_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5f865ed4c43..e21194566b7 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, int r; gfn_t base_gfn; unsigned long npages, ugfn; - int largepages; - unsigned long i; + unsigned long largepages, i; struct kvm_memory_slot *memslot; struct kvm_memory_slot old, new; -- cgit v1.2.3-18-g5258