vserver 1.9.5.x5
[linux-2.6.git] / arch / ia64 / mm / contig.c
index 0f905a6..b9b3e62 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/sections.h>
+#include <asm/mca.h>
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
 static unsigned long num_dma_physpages;
@@ -214,8 +215,8 @@ count_dma_pages (u64 start, u64 end, void *arg)
 {
        unsigned long *count = arg;
 
-       if (end <= MAX_DMA_ADDRESS)
-               *count += (end - start) >> PAGE_SHIFT;
+       if (start < MAX_DMA_ADDRESS)
+               *count += (min(end, MAX_DMA_ADDRESS) - start) >> PAGE_SHIFT;
        return 0;
 }
 #endif