Skip to contentSkip to conversation

page_check_range: fix wrap around test

PATCH New Lauro Ramos Venancio 1 participant 1 message Oct 15, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 page_check_range: fix wrap around test

Move up the warp around test because line
'end = TARGET_PAGE_ALIGN(start+len);'
can interfere on it causing Segmentation Fault.

Signature · 2 lines
Lauro Ramos Venancio
INdT - Instituto Nokia de Tecnologia
exec.c +4 -3
Index: exec.c
===================================================================
@@ -2068,12 +2068,13 @@
     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 )