From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrTYe-0004r9-7R for qemu-devel@nongnu.org; Sun, 29 Jan 2012 07:08:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrTYd-0007qn-5H for qemu-devel@nongnu.org; Sun, 29 Jan 2012 07:08:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrTYc-0007qi-V0 for qemu-devel@nongnu.org; Sun, 29 Jan 2012 07:08:31 -0500 Message-ID: <4F2536B9.4070305@redhat.com> Date: Sun, 29 Jan 2012 14:08:25 +0200 From: Avi Kivity MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] exec-obsolete: fix length handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel , Stefan Berger On 01/28/2012 08:13 PM, Blue Swirl wrote: > Fix suspend/resume broken by off-by-one error in > 59abb06198ee9471e29c970f294eae80c0b39be1. > > Adjust the loop so that it handles correctly the case > start = (ram_addr_t)-TARGET_PAGE_SIZE, length = TARGET_PAGE_SIZE. > > Reported-by: Stefan Berger > Signed-off-by: Blue Swirl > --- > exec-obsolete.h | 10 ++++------ > 1 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/exec-obsolete.h b/exec-obsolete.h > index 03cf35e..1bba970 100644 > --- a/exec-obsolete.h > +++ b/exec-obsolete.h > @@ -81,11 +81,10 @@ static inline void > cpu_physical_memory_set_dirty_range(ram_addr_t start, > int dirty_flags) > { > uint8_t *p; > - ram_addr_t addr, end; > + ram_addr_t cur; > > - end = start + length; > p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); > - for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) { > + for (cur = 0; cur < length; cur += TARGET_PAGE_SIZE) { > *p++ |= dirty_flags; > } I think this is still wrong - if length == 2 it will iterate once, but we need two iterations if start == 0xfff. -- error compiling committee.c: too many arguments to function