On 14/12/19 17:02, Philippe Mathieu-Daudé wrote:
> 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é <[email protected]>
> ---
>  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);
>  }
> 

I think in some cases this could be intentional, for example if you have
different models with different BAR sizes and you organize this with the
same tree of MemoryRegion and different sizes for the parent.  I'm not
saying this happens in the current devices we support, I'm just
wondering if it should be a reason not to apply the patch.  I suppose
you did spend some time debugging something where the patch would have
been useful; what was that something?

Paolo


Reply via email to