From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkqzp-0003UU-AI for qemu-devel@nongnu.org; Wed, 11 Jan 2012 00:45:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkqzl-0000AK-2x for qemu-devel@nongnu.org; Wed, 11 Jan 2012 00:45:13 -0500 Received: from ozlabs.org ([203.10.76.45]:33773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkqzk-00005N-LM for qemu-devel@nongnu.org; Wed, 11 Jan 2012 00:45:09 -0500 From: David Gibson Date: Wed, 11 Jan 2012 16:44:50 +1100 Message-Id: <1326260692-7272-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1326260692-7272-1-git-send-email-david@gibson.dropbear.id.au> References: <1326260692-7272-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 2/4] Fix dirty logging with 32-bit qemu & 64-bit guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: agraf@suse.de, qemu-devel@nongnu.org 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 --- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 3174f42..363c697 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.7.7.3