Commit 62518b8b1dccb67969688228f14fb379f1918ede

Authored by Jan Kiszka
Committed by Anthony Liguori
1 parent 4495d6a7

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>
Showing 1 changed file with 1 additions and 1 deletions
kvm-all.c
... ... @@ -290,7 +290,7 @@ void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
290 290 return;
291 291 }
292 292  
293   - alloc_size = mem->memory_size >> TARGET_PAGE_BITS / sizeof(d.dirty_bitmap);
  293 + alloc_size = ((mem->memory_size >> TARGET_PAGE_BITS) + 7) / 8;
294 294 d.dirty_bitmap = qemu_mallocz(alloc_size);
295 295  
296 296 d.slot = mem->slot;
... ...