[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] memory: Do not allow subregion out of the parent region range
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH] memory: Do not allow subregion out of the parent region range |
Date: |
Sat, 14 Dec 2019 17:02:23 +0100 |
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é <address@hidden>
---
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
- [PATCH] memory: Do not allow subregion out of the parent region range,
Philippe Mathieu-Daudé <=
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Paolo Bonzini, 2019/12/16
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Philippe Mathieu-Daudé, 2019/12/16
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Paolo Bonzini, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Christophe de Dinechin, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Richard Henderson, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Peter Maydell, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Paolo Bonzini, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Alex Williamson, 2019/12/17
- Re: [PATCH] memory: Do not allow subregion out of the parent region range, Philippe Mathieu-Daudé, 2019/12/17