summaryrefslogtreecommitdiffstats
path: root/mm/mremap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-03 15:23:11 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-11 06:44:58 -0500
commit9206de95b1ea68357996ec02be5db0638a0de2c1 (patch)
treee32b41a06a8465af0e8cfa0660b517930cc2fea5 /mm/mremap.c
parent8c7b49b3ecd48923eb64ff57e07a1cdb74782970 (diff)
downloadlinux-9206de95b1ea68357996ec02be5db0638a0de2c1.tar.gz
linux-9206de95b1ea68357996ec02be5db0638a0de2c1.tar.bz2
linux-9206de95b1ea68357996ec02be5db0638a0de2c1.zip
Take arch_mmap_check() into get_unmapped_area()
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r--mm/mremap.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index bbbbbf507ff3..845190898d59 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -27,10 +27,6 @@
#include "internal.h"
-#ifndef arch_mmap_check
-#define arch_mmap_check(addr, len, flags) (0)
-#endif
-
static pmd_t *get_old_pmd(struct mm_struct *mm, unsigned long addr)
{
pgd_t *pgd;
@@ -366,9 +362,7 @@ static unsigned long mremap_to(unsigned long addr,
map_flags = MAP_FIXED;
if (vma->vm_flags & VM_MAYSHARE)
map_flags |= MAP_SHARED;
- ret = arch_mmap_check(new_addr, new_len, map_flags);
- if (ret)
- goto out1;
+
ret = get_unmapped_area(vma->vm_file, new_addr, new_len, vma->vm_pgoff +
((addr - vma->vm_start) >> PAGE_SHIFT),
map_flags);
@@ -388,12 +382,9 @@ out:
static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
{
unsigned long end = vma->vm_end + delta;
- unsigned long max_addr = TASK_SIZE;
- if (vma->vm_next)
- max_addr = vma->vm_next->vm_start;
- if (max_addr < end || end < vma->vm_end)
+ if (end < vma->vm_end) /* overflow */
return 0;
- if (arch_mmap_check(vma->vm_start, end - vma->vm_start, MAP_FIXED))
+ if (vma->vm_next && vma->vm_next->vm_start < end) /* intersection */
return 0;
if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start,
0, MAP_FIXED) & ~PAGE_MASK)