diff options
author | Avi Kivity <avi@redhat.com> | 2009-06-08 15:55:21 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-02 16:49:33 -0700 |
commit | 83efa8edb43ad69a5f801334170d41557cdca89b (patch) | |
tree | f19bfe2a643f62d2344a59d0741dcb21832edc95 /virt | |
parent | e7ecb754d1a924096795c2dad432f33543f4ffbb (diff) | |
download | lwn-83efa8edb43ad69a5f801334170d41557cdca89b.tar.gz lwn-83efa8edb43ad69a5f801334170d41557cdca89b.zip |
KVM: Prevent overflow in largepages calculation
commit 09f8ca74ae6c2d78b2c7f6c0751ed0cbe815a3d9 upstream.
If userspace specifies a memory slot that is larger than 8 petabytes, it
could overflow the largepages variable.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index cf4bdc97faa4..acef47527711 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -920,8 +920,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; |