From: Paolo Bonzini Date: Mon, 18 May 2015 06:35:43 +0000 (+0200) Subject: KVM: mips: use id_to_memslot correctly X-Git-Tag: v3.16.35~1809 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d1408875c05909a3e7ed9671b34aeda4ae51302;p=thirdparty%2Fkernel%2Fstable.git KVM: mips: use id_to_memslot correctly commit 69a1220060c1523fd0515216eaa29e22f133b894 upstream. The argument to KVM_GET_DIRTY_LOG is a memslot id; it may not match the position in the memslots array, which is sorted by gfn. Reviewed-by: James Hogan Signed-off-by: Paolo Bonzini [ luis: backported to 3.16: - file rename: arch/mips/kvm/mips.c -> arch/mips/kvm/kvm_mips.c ] Signed-off-by: Luis Henriques --- diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 59298b97ac39b..cc721a3c89962 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -813,7 +813,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) /* If nothing is dirty, don't bother messing with page tables. */ if (is_dirty) { - memslot = &kvm->memslots->memslots[log->slot]; + memslot = id_to_memslot(kvm->memslots, log->slot); ga = memslot->base_gfn << PAGE_SHIFT; ga_end = ga + (memslot->npages << PAGE_SHIFT);