[PATCH] hugetlb: fix error return for brk() entering a hugepage region

Commit cb07c9a1864a8eac9f3123e428100d5b2a16e65a causes the wrong return
value. is_hugepage_only_range() is a boolean, so we should return
-EINVAL rather than 1.

Also - we can use "mm" instead of looking up "current->mm" again.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Hugh Dickins and committed by Linus Torvalds cd2579d7 1f794b60

+2 -3
+2 -3
mm/mmap.c
··· 1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr) 1881 return -EINVAL; 1882 1883 - error = is_hugepage_only_range(current->mm, addr, len); 1884 - if (error) 1885 - return error; 1886 1887 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 1888
··· 1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr) 1881 return -EINVAL; 1882 1883 + if (is_hugepage_only_range(mm, addr, len)) 1884 + return -EINVAL; 1885 1886 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 1887