Skip to content

Commit

Permalink
sparc: Fix mmap VA span checking.
Browse files Browse the repository at this point in the history
We should not conditionalize VA range checks on MAP_FIXED.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 7, 2008
1 parent d45100f commit 5816339
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions arch/sparc/kernel/sys_sparc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc64/kernel/sys_sparc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5816339

Please sign in to comment.