diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 772b17db9698248e4df19bc3ca874ff278d63fd9..c57fbb6d7e70ed095ef7c8bac3bf69501deb339e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1305,7 +1305,8 @@ int __kvm_set_memory_region(struct kvm *kvm, id = (u16)mem->slot; /* General sanity checks */ - if (mem->memory_size & (PAGE_SIZE - 1)) + if ((mem->memory_size & (PAGE_SIZE - 1)) || + (mem->memory_size != (unsigned long)mem->memory_size)) return -EINVAL; if (mem->guest_phys_addr & (PAGE_SIZE - 1)) return -EINVAL;