summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2022-12-09 02:53:02 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-12-27 12:00:50 +0100
commit92c8191bb5d3f670ed806f91823381193288a4e1 (patch)
treeb4084902e080c68f43c7d2957f99c4f5a77bd100 /tools
parentKVM: arm64: selftests: Don't identity map the ucall MMIO hole (diff)
downloadlinux-92c8191bb5d3f670ed806f91823381193288a4e1.tar.xz
linux-92c8191bb5d3f670ed806f91823381193288a4e1.zip
KVM: selftests: Mark correct page as mapped in virt_map()
The loop marks vaddr as mapped after incrementing it by page size, thereby marking the *next* page as mapped. Set the bit in vpages_mapped first instead. Fixes: 56fc7732031d ("KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too") Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Message-Id: <20221209015307.1781352-4-oliver.upton@linux.dev> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/kvm/lib/kvm_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index bd892a814951..56d5ea949cbb 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -1425,10 +1425,10 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,
while (npages--) {
virt_pg_map(vm, vaddr, paddr);
+ sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
+
vaddr += page_size;
paddr += page_size;
-
- sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
}
}