switch do_brk() to get_unmapped_area()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 4 Dec 2009 00:40:46 +0000 (19:40 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 11 Dec 2009 11:44:58 +0000 (06:44 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
mm/mmap.c

index c04146da8efdce2fcacc16ff0fa0a43359573d38..ed70a68e882af069988cfcbe5c54a9a0af88d9fa 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1985,20 +1985,14 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
        if (!len)
                return addr;
 
-       if ((addr + len) > TASK_SIZE || (addr + len) < addr)
-               return -EINVAL;
-
-       if (is_hugepage_only_range(mm, addr, len))
-               return -EINVAL;
-
        error = security_file_mmap(NULL, 0, 0, 0, addr, 1);
        if (error)
                return error;
 
        flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 
-       error = arch_mmap_check(addr, len, flags);
-       if (error)
+       error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
+       if (error & ~PAGE_MASK)
                return error;
 
        /*