From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel@nongnu.org,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Tyler Hall <tylerwhall@gmail.com>
Subject: [Qemu-devel] [PATCH 5/7] exec.c: Fix off-by-one error in register_subpage
Date: Fri, 3 Aug 2012 11:51:04 +0100 [thread overview]
Message-ID: <1343991066-9814-6-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1343991066-9814-1-git-send-email-stefanha@linux.vnet.ibm.com>
From: Tyler Hall <tylerwhall@gmail.com>
subpage_register() expects "end" to be the last byte in the mapping.
Registering a non-page-aligned memory region that extends up to or
beyond a page boundary causes subpage_register() to silently fail
through the (end >= PAGE_SIZE) check.
This bug does not cause noticeable problems for mappings that do not
extend to a page boundary, though they do register an extra byte.
Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exec.c b/exec.c
index feb4795..27b100c 100644
--- a/exec.c
+++ b/exec.c
@@ -2271,7 +2271,7 @@ static void register_subpage(MemoryRegionSection *section)
subpage = container_of(existing->mr, subpage_t, iomem);
}
start = section->offset_within_address_space & ~TARGET_PAGE_MASK;
- end = start + section->size;
+ end = start + section->size - 1;
subpage_register(subpage, start, end, phys_section_add(section));
}
--
1.7.10.4
next prev parent reply other threads:[~2012-08-03 10:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 10:50 [Qemu-devel] [PULL 0/7] Trivial patches for 22 July to 3 August 2012 Stefan Hajnoczi
2012-08-03 10:51 ` [Qemu-devel] [PATCH 1/7] usb: Clean common object and dependency files Stefan Hajnoczi
2012-08-03 10:51 ` [Qemu-devel] [PATCH 2/7] qom: Clean libuser " Stefan Hajnoczi
2012-08-03 10:51 ` [Qemu-devel] [PATCH 3/7] remove unused include of error.h Stefan Hajnoczi
2012-08-03 13:00 ` Luiz Capitulino
2012-08-03 13:24 ` Stefan Hajnoczi
2012-08-03 10:51 ` [Qemu-devel] [PATCH 4/7] socket: clean up redundant assignment Stefan Hajnoczi
2012-08-03 10:51 ` Stefan Hajnoczi [this message]
2012-08-03 10:51 ` [Qemu-devel] [PATCH 6/7] exec.c: Use subpages for large unaligned mappings Stefan Hajnoczi
2012-08-03 10:51 ` [Qemu-devel] [PATCH 7/7] exec.c: Remove out of date comment Stefan Hajnoczi
2012-08-03 13:27 ` [Qemu-devel] [PULL 0/7] Trivial patches for 22 July to 3 August 2012 Stefan Hajnoczi
2012-08-03 20:43 ` Anthony Liguori
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=1343991066-9814-6-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=tylerwhall@gmail.com \
/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).