sparc: Fix mmap VA span checking.

We should not conditionalize VA range checks on MAP_FIXED.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2008-05-07 02:24:28 -07:00
parent d45100f7b6
commit 5816339310
2 changed files with 3 additions and 4 deletions

View File

@ -223,8 +223,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
{ {
if (ARCH_SUN4C_SUN4 && if (ARCH_SUN4C_SUN4 &&
(len > 0x20000000 || (len > 0x20000000 ||
((flags & MAP_FIXED) && (addr < 0xe0000000 && addr + len > 0x20000000)))
addr < 0xe0000000 && addr + len > 0x20000000)))
return -EINVAL; return -EINVAL;
/* See asm-sparc/uaccess.h */ /* See asm-sparc/uaccess.h */

View File

@ -549,13 +549,13 @@ int sparc64_mmap_check(unsigned long addr, unsigned long len,
if (len >= STACK_TOP32) if (len >= STACK_TOP32)
return -EINVAL; return -EINVAL;
if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) if (addr > STACK_TOP32 - len)
return -EINVAL; return -EINVAL;
} else { } else {
if (len >= VA_EXCLUDE_START) if (len >= VA_EXCLUDE_START)
return -EINVAL; return -EINVAL;
if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) if (invalid_64bit_range(addr, len))
return -EINVAL; return -EINVAL;
} }