From: Pete Zaitcev <zaitcev@redhat.com>

On sparc, the PTE_FILE_MAX_BITS is variable (Worse, actually...  we change
all occurences in kernel text segment to correct value at boot time.) This
should not harm other arches, because gcc is capable to optimize constant
conditions.



 mm/fremap.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff -puN mm/fremap.c~sparc-PTE_FILE_MAX_BITS-fix mm/fremap.c
--- 25/mm/fremap.c~sparc-PTE_FILE_MAX_BITS-fix	2003-04-09 01:58:58.000000000 -0700
+++ 25-akpm/mm/fremap.c	2003-04-09 01:58:58.000000000 -0700
@@ -135,10 +135,10 @@ long sys_remap_file_pages(unsigned long 
 		return err;
 
 	/* Can we represent this offset inside this architecture's pte's? */
-#if PTE_FILE_MAX_BITS < BITS_PER_LONG
-	if (pgoff + (size >> PAGE_SHIFT) >= (1UL << PTE_FILE_MAX_BITS))
-		return err;
-#endif
+	/* This needs to be evaluated at runtime on some platforms */
+	if (PTE_FILE_MAX_BITS < BITS_PER_LONG)
+		if (pgoff + (size >> PAGE_SHIFT) >= (1ULL << PTE_FILE_MAX_BITS))
+			return err;
 
 	down_read(&mm->mmap_sem);
 

_