From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwWNh-000661-48 for qemu-devel@nongnu.org; Wed, 01 Aug 2012 06:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwWNb-0000ex-Ey for qemu-devel@nongnu.org; Wed, 01 Aug 2012 06:42:21 -0400 Date: Wed, 1 Aug 2012 11:42:12 +0100 From: Stefan Hajnoczi Message-ID: <20120801104212.GB17816@stefanha-thinkpad.localdomain> References: <1343256304-32029-1-git-send-email-tylerwhall@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1343256304-32029-1-git-send-email-tylerwhall@gmail.com> Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] exec.c: Fix off-by-one error in register_subpage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tyler Hall Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Avi Kivity On Wed, Jul 25, 2012 at 06:45:03PM -0400, Tyler Hall wrote: > subpage_register() expects "end" to be the last byte in the mapping. > Registering a non-page-aligned memory region that extends up to or > beyond a page boundary causes subpage_register() to silently fail > through the (end >= PAGE_SIZE) check. > > This bug does not cause noticeable problems for mappings that do not > extend to a page boundary, though they do register an extra byte. > > Signed-off-by: Tyler Hall > --- > exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/exec.c b/exec.c > index feb4795..27b100c 100644 > --- a/exec.c > +++ b/exec.c > @@ -2271,7 +2271,7 @@ static void register_subpage(MemoryRegionSection *section) > subpage = container_of(existing->mr, subpage_t, iomem); > } > start = section->offset_within_address_space & ~TARGET_PAGE_MASK; > - end = start + section->size; > + end = start + section->size - 1; > subpage_register(subpage, start, end, phys_section_add(section)); > } I would really like to see an Acked-by: or Signed-off-by: from Avi or someone else who is familiar with the memory regions code. Especially for Patch 2/2. Stefan