Skip to content

Commit 92c8191

Browse files
ouptonbonzini
authored andcommitted
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: 56fc773 ("KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too") Signed-off-by: Oliver Upton <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 7a16142 commit 92c8191

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/kvm/lib/kvm_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,10 +1425,10 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,
14251425

14261426
while (npages--) {
14271427
virt_pg_map(vm, vaddr, paddr);
1428+
sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
1429+
14281430
vaddr += page_size;
14291431
paddr += page_size;
1430-
1431-
sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
14321432
}
14331433
}
14341434

0 commit comments

Comments
 (0)