Commit cd2579d7aa7bfc966cc271a88e77f8cfc3b0b7ba

Authored by Hugh Dickins
Committed by Linus Torvalds
1 parent 1f794b6082

[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>

Showing 1 changed file with 2 additions and 3 deletions Side-by-side Diff

... ... @@ -1880,9 +1880,8 @@
1880 1880 if ((addr + len) > TASK_SIZE || (addr + len) < addr)
1881 1881 return -EINVAL;
1882 1882  
1883   - error = is_hugepage_only_range(current->mm, addr, len);
1884   - if (error)
1885   - return error;
  1883 + if (is_hugepage_only_range(mm, addr, len))
  1884 + return -EINVAL;
1886 1885  
1887 1886 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
1888 1887