[PATCH] 2.2.18pre2: fencepost error in __ioremap() [AGP]

2000-09-01 Thread Chip Salzenberg

The AGP patches add some code to __ioremap.  That code seems to me to
have a fencepost error.

In the below hunk, note that temp_end is set to "temp_addr+(size-1)".
It points _at_ the last page to be examined, not beyond it.  So the
loop should be controlled by a "<=" test, not a "<" test.  Without
this patch, the last page in the range is not tested for reservation.

Index: arch/i386/mm/ioremap.c
--- arch/i386/mm/ioremap.c.prev
+++ arch/i386/mm/ioremap.c  Fri Sep  1 20:11:25 2000
@@ -118,5 +118,5 @@ void * __ioremap(unsigned long phys_addr
temp_end = temp_addr + (size - 1);
  
-   for(i = MAP_NR(temp_addr); i < MAP_NR(temp_end); i++) {
+   for(i = MAP_NR(temp_addr); i <= MAP_NR(temp_end); i++) {
if(!PageReserved(mem_map + i))
return NULL;

-- 
Chip Salzenberg  - a.k.a. -  <[EMAIL PROTECTED]>
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early."  // MST3K
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[PATCH] 2.2.18pre2: fencepost error in __ioremap() [AGP]

2000-09-01 Thread Chip Salzenberg

The AGP patches add some code to __ioremap.  That code seems to me to
have a fencepost error.

In the below hunk, note that temp_end is set to "temp_addr+(size-1)".
It points _at_ the last page to be examined, not beyond it.  So the
loop should be controlled by a "=" test, not a "" test.  Without
this patch, the last page in the range is not tested for reservation.

Index: arch/i386/mm/ioremap.c
--- arch/i386/mm/ioremap.c.prev
+++ arch/i386/mm/ioremap.c  Fri Sep  1 20:11:25 2000
@@ -118,5 +118,5 @@ void * __ioremap(unsigned long phys_addr
temp_end = temp_addr + (size - 1);
  
-   for(i = MAP_NR(temp_addr); i  MAP_NR(temp_end); i++) {
+   for(i = MAP_NR(temp_addr); i = MAP_NR(temp_end); i++) {
if(!PageReserved(mem_map + i))
return NULL;

-- 
Chip Salzenberg  - a.k.a. -  [EMAIL PROTECTED]
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early."  // MST3K
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/