All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memory: Do not allow subregion out of the parent region range
@ 2019-12-14 16:02 Philippe Mathieu-Daudé
  2019-12-16 13:08 ` Paolo Bonzini
  0 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-14 16:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Peter Maydell

If a subregion is mapped out of the parent region range, it
will never get accessed. Since this is a bug, abort to help
the developer notice the mistake.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 memory.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/memory.c b/memory.c
index 06484c2bff..61f355dcd5 100644
--- a/memory.c
+++ b/memory.c
@@ -2390,6 +2390,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,
 {
     assert(!subregion->container);
     subregion->container = mr;
+    assert(offset + memory_region_size(subregion) <= memory_region_size(mr));
     subregion->addr = offset;
     memory_region_update_container_subregions(subregion);
 }
-- 
2.21.0



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

end of thread, other threads:[~2019-12-17 19:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-14 16:02 [PATCH] memory: Do not allow subregion out of the parent region range Philippe Mathieu-Daudé
2019-12-16 13:08 ` Paolo Bonzini
2019-12-16 17:46   ` Philippe Mathieu-Daudé
2019-12-17 10:51     ` Paolo Bonzini
2019-12-17 11:58       ` Christophe de Dinechin
2019-12-17 16:57         ` Richard Henderson
2019-12-17 18:17           ` Peter Maydell
2019-12-17 18:31             ` Paolo Bonzini
2019-12-17 18:52               ` Alex Williamson
2019-12-17 19:17                 ` Philippe Mathieu-Daudé

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.