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é <phi...@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