diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 162817f853ec..759af6596a07 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -679,8 +679,14 @@ static void update_memslots(struct kvm_memslots *slots, | |||
679 | struct kvm_memory_slot *mslots = slots->memslots; | 679 | struct kvm_memory_slot *mslots = slots->memslots; |
680 | 680 | ||
681 | WARN_ON(mslots[i].id != id); | 681 | WARN_ON(mslots[i].id != id); |
682 | if (!new->npages) | 682 | if (!new->npages) { |
683 | new->base_gfn = 0; | 683 | new->base_gfn = 0; |
684 | if (mslots[i].npages) | ||
685 | slots->used_slots--; | ||
686 | } else { | ||
687 | if (!mslots[i].npages) | ||
688 | slots->used_slots++; | ||
689 | } | ||
684 | 690 | ||
685 | while (i < KVM_MEM_SLOTS_NUM - 1 && | 691 | while (i < KVM_MEM_SLOTS_NUM - 1 && |
686 | new->base_gfn <= mslots[i + 1].base_gfn) { | 692 | new->base_gfn <= mslots[i + 1].base_gfn) { |