Skip to content

Commit

Permalink
KVM: Prevent overflow in largepages calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Avi Kivity committed Jun 10, 2009
1 parent ac04527 commit 09f8ca7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 09f8ca7

Please sign in to comment.