Skip to content

Commit

Permalink
powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
jmarchan@redhat.com authored and Benjamin Herrenschmidt committed Jan 29, 2014
1 parent 2c2e6ec commit 19751c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/mm/slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 19751c0

Please sign in to comment.