Fix dirty logging with 32-bit qemu & 64-bit guests
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Jan 2012 19:46:21 +0000 (19:46 +0000)
committerAlexander Graf <agraf@suse.de>
Sat, 21 Jan 2012 04:17:01 +0000 (05:17 +0100)
The kvm_get_dirty_pages_log_range() function uses two address
variables to step through the monitored memory region to update the
dirty log.  However, these variables have type unsigned long, which
can overflow if running a 64-bit guest with a 32-bit qemu binary.

This patch changes these to target_phys_addr_t which will have the
correct size.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
kvm-all.c

index 2cc45629212f1f12c69703b96aeca9b5dca40437..9e84d35e94be70227d635cd49b78d8d71a055077 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -344,7 +344,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
                                          unsigned long *bitmap)
 {
     unsigned int i, j;
-    unsigned long page_number, addr, addr1, c;
+    unsigned long page_number, c;
+    target_phys_addr_t addr, addr1;
     unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
 
     /*