Commit 55f280c90ed7288b392fcf718efc2d3caca11e91
1 parent
d732dcb4
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
Showing
1 changed file
with
4 additions
and
3 deletions
exec.c
| @@ -2081,12 +2081,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags) | @@ -2081,12 +2081,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags) | ||
| 2081 | target_ulong end; | 2081 | target_ulong end; |
| 2082 | target_ulong addr; | 2082 | target_ulong addr; |
| 2083 | 2083 | ||
| 2084 | + if (start + len < start) | ||
| 2085 | + /* we've wrapped around */ | ||
| 2086 | + return -1; | ||
| 2087 | + | ||
| 2084 | end = TARGET_PAGE_ALIGN(start+len); /* must do before we loose bits in the next step */ | 2088 | end = TARGET_PAGE_ALIGN(start+len); /* must do before we loose bits in the next step */ |
| 2085 | start = start & TARGET_PAGE_MASK; | 2089 | start = start & TARGET_PAGE_MASK; |
| 2086 | 2090 | ||
| 2087 | - if( end < start ) | ||
| 2088 | - /* we've wrapped around */ | ||
| 2089 | - return -1; | ||
| 2090 | for(addr = start; addr < end; addr += TARGET_PAGE_SIZE) { | 2091 | for(addr = start; addr < end; addr += TARGET_PAGE_SIZE) { |
| 2091 | p = page_find(addr >> TARGET_PAGE_BITS); | 2092 | p = page_find(addr >> TARGET_PAGE_BITS); |
| 2092 | if( !p ) | 2093 | if( !p ) |