summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-28 10:24:11 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-28 10:24:11 +0000
commit55f280c90ed7288b392fcf718efc2d3caca11e91 (patch)
treed19001e25dc7b66808e4112b4ab49d1915a301e0 /exec.c
parentd732dcb442ce810709f48d7a105b573efda118a2 (diff)
downloadqemu-55f280c90ed7288b392fcf718efc2d3caca11e91.tar.gz
page_check_range: fix wrap around test (Lauro Ramos Venancio).
Move up the warp around test because line 'end = TARGET_PAGE_ALIGN(start+len);' can interfere with it. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5563 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index f1fcec833c..697a19eb25 100644
--- a/exec.c
+++ b/exec.c
@@ -2081,12 +2081,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags)
target_ulong end;
target_ulong addr;
+ if (start + len < start)
+ /* we've wrapped around */
+ return -1;
+
end = TARGET_PAGE_ALIGN(start+len); /* must do before we loose bits in the next step */
start = start & TARGET_PAGE_MASK;
- if( end < start )
- /* we've wrapped around */
- return -1;
for(addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
p = page_find(addr >> TARGET_PAGE_BITS);
if( !p )