summaryrefslogtreecommitdiff
path: root/drivers/kvm
diff options
context:
space:
mode:
authorUri Lublin <uril@qumranet.com>2007-02-22 17:43:09 +0300
committerAvi Kivity <avi@qumranet.com>2007-03-04 12:12:42 +0300
commitcd1a4a982a78e793125db2f386e91dc7c89c9ed1 (patch)
tree7e5e9dd9534feed9ecc83c147e2f6166a6edbc48 /drivers/kvm
parentab51a434c5816e1ca3f033791c1cc5c6594998ec (diff)
downloadlinux-cd1a4a982a78e793125db2f386e91dc7c89c9ed1.tar.xz
KVM: Fix dirty page log bitmap size/access calculation
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>
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index edff4055b32b..e7108105c50b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -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;