powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed address space

According to Posix, if MAP_FIXED is specified mmap shall set ENOMEM if
the requested mapping exceeds the allowed range for address space of
the process. The generic code set it right, but the specific powerpc
slice_get_unmapped_area() function currently returns -EINVAL in that
case.
This patch corrects it.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
jmarchan@redhat.com 2014-01-15 16:27:11 +01:00 committed by Benjamin Herrenschmidt
parent 2c2e6ecfd0
commit 19751c07b3
1 changed files with 1 additions and 1 deletions

View File

@ -408,7 +408,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
if (fixed && (addr & ((1ul << pshift) - 1)))
return -EINVAL;
if (fixed && addr > (mm->task_size - len))
return -EINVAL;
return -ENOMEM;
/* If hint, make sure it matches our alignment restrictions */
if (!fixed && addr) {