summaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-05-01 20:52:47 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-22 10:50:33 -0500
commit62518b8b1dccb67969688228f14fb379f1918ede (patch)
treee4942fb579f1861d9e0a9861060db8c2e79a8fef /kvm-all.c
parent4495d6a74575b4ee7e9aabdc66e67b6c9e19a698 (diff)
downloadqemu-62518b8b1dccb67969688228f14fb379f1918ede.tar.gz
kvm: Fix dirty log temporary buffer size
The buffer passed to KVM_GET_DIRTY_LOG requires one bit per page. Fix the size calculation in kvm_physical_sync_dirty_bitmap accordingly, avoiding allocation of extremly oversized buffers. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kvm-all.c b/kvm-all.c
index f4851c0078..3b6b5ed423 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -290,7 +290,7 @@ void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
return;
}
- alloc_size = mem->memory_size >> TARGET_PAGE_BITS / sizeof(d.dirty_bitmap);
+ alloc_size = ((mem->memory_size >> TARGET_PAGE_BITS) + 7) / 8;
d.dirty_bitmap = qemu_mallocz(alloc_size);
d.slot = mem->slot;