All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH 1/2] exec.c: Fix off-by-one error in register_subpage
@ 2012-07-25 22:45 ` Tyler Hall
  0 siblings, 0 replies; 18+ messages in thread
From: Tyler Hall @ 2012-07-25 22:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Tyler Hall

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 <tylerwhall@gmail.com>
---
 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));
 }
 
-- 
1.7.11



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-08-03  9:55 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-25 22:45 [Qemu-trivial] [PATCH 1/2] exec.c: Fix off-by-one error in register_subpage Tyler Hall
2012-07-25 22:45 ` [Qemu-devel] " Tyler Hall
2012-07-25 22:45 ` [Qemu-trivial] [PATCH 2/2] exec.c: Use subpages for large unaligned mappings Tyler Hall
2012-07-25 22:45   ` [Qemu-devel] " Tyler Hall
2012-08-01 13:02   ` [Qemu-trivial] " Avi Kivity
2012-08-01 13:02     ` Avi Kivity
2012-08-01 10:42 ` [Qemu-trivial] [PATCH 1/2] exec.c: Fix off-by-one error in register_subpage Stefan Hajnoczi
2012-08-01 10:42   ` [Qemu-devel] " Stefan Hajnoczi
2012-08-01 12:52   ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2012-08-01 12:52     ` [Qemu-devel] [Qemu-trivial] " Peter Maydell
2012-08-01 12:56 ` [Qemu-trivial] [Qemu-devel] " Avi Kivity
2012-08-01 12:56   ` Avi Kivity
2012-08-01 13:01   ` [Qemu-trivial] " Stefan Hajnoczi
2012-08-01 13:01     ` Stefan Hajnoczi
2012-08-01 13:03     ` [Qemu-trivial] " Avi Kivity
2012-08-01 13:03       ` Avi Kivity
2012-08-03  9:55 ` [Qemu-trivial] " Stefan Hajnoczi
2012-08-03  9:55   ` [Qemu-devel] " Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.