From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoSQF-0007Ds-38 for qemu-devel@nongnu.org; Fri, 20 Jan 2012 23:19:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoSQA-0001Sz-Et for qemu-devel@nongnu.org; Fri, 20 Jan 2012 23:19:22 -0500 From: Alexander Graf Date: Sat, 21 Jan 2012 05:19:01 +0100 Message-Id: <1327119551-29674-17-git-send-email-agraf@suse.de> In-Reply-To: <1327119551-29674-1-git-send-email-agraf@suse.de> References: <1327119551-29674-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 16/26] Fix dirty logging with 32-bit qemu & 64-bit guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: qemu-devel Developers , Blue Swirl , Aurelien Jarno , David Gibson From: Benjamin Herrenschmidt 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 Signed-off-by: David Gibson Signed-off-by: Alexander Graf --- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 2cc4562..9e84d35 100644 --- 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; /* -- 1.6.0.2