From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: [PATCH] memory: Do not allow subregion out of the parent region range
Date: Sat, 14 Dec 2019 17:02:23 +0100 [thread overview]
Message-ID: <20191214160223.20012-1-philmd@redhat.com> (raw)
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
next reply other threads:[~2019-12-14 21:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-14 16:02 Philippe Mathieu-Daudé [this message]
2019-12-16 13:08 ` [PATCH] memory: Do not allow subregion out of the parent region range 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é
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191214160223.20012-1-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).