sparc: Fix mmap VA span checking.
authorDavid S. Miller <davem@davemloft.net>
Wed, 7 May 2008 09:24:28 +0000 (02:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 May 2008 09:24:28 +0000 (02:24 -0700)
We should not conditionalize VA range checks on MAP_FIXED.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/sys_sparc.c
arch/sparc64/kernel/sys_sparc.c

index f188b5dc9fd001bec3691b03401408b5af655ce4..e995491c443627d5e0e1b5f363990608b946685f 100644 (file)
@@ -223,8 +223,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
 {
        if (ARCH_SUN4C_SUN4 &&
            (len > 0x20000000 ||
-            ((flags & MAP_FIXED) &&
-             addr < 0xe0000000 && addr + len > 0x20000000)))
+            (addr < 0xe0000000 && addr + len > 0x20000000)))
                return -EINVAL;
 
        /* See asm-sparc/uaccess.h */
index 8d4761f15fa932cdede6dc4dc4336fdaa2b1cc88..0dbc941f130e6f8163422b0e42306bc68d226162 100644 (file)
@@ -549,13 +549,13 @@ int sparc64_mmap_check(unsigned long addr, unsigned long len,
                if (len >= STACK_TOP32)
                        return -EINVAL;
 
-               if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len)
+               if (addr > STACK_TOP32 - len)
                        return -EINVAL;
        } else {
                if (len >= VA_EXCLUDE_START)
                        return -EINVAL;
 
-               if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len))
+               if (invalid_64bit_range(addr, len))
                        return -EINVAL;
        }