qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/8] kvm: Fix dirty log temporary buffer size


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 3/8] kvm: Fix dirty log temporary buffer size
Date: Fri, 01 May 2009 23:17:20 +0200
User-agent: StGIT/0.14.2

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 <address@hidden>
---

 kvm-all.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 3844398..17e5b38 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;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]