Skip to content

Commit

Permalink
KVM: Fix dirty page log bitmap size/access calculation
Browse files Browse the repository at this point in the history
Since dirty_bitmap is an unsigned long array, the alignment and size need
to take that into account.

Signed-off-by: Uri Lublin <uril@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
  • Loading branch information
Uri Lublin authored and Avi Kivity committed Mar 4, 2007
1 parent ab51a43 commit cd1a4a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ static int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
if (!memslot->dirty_bitmap)
goto out;

n = ALIGN(memslot->npages, 8) / 8;
n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;

for (i = 0; !any && i < n; ++i)
for (i = 0; !any && i < n/sizeof(long); ++i)
any = memslot->dirty_bitmap[i];

r = -EFAULT;
Expand Down

0 comments on commit cd1a4a9

Please sign in to comment.