Skip to content

Commit 19751c0

Browse files
jeromemarchandozbenh
authored andcommitted
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>
1 parent 2c2e6ec commit 19751c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/powerpc/mm/slice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
408408
if (fixed && (addr & ((1ul << pshift) - 1)))
409409
return -EINVAL;
410410
if (fixed && addr > (mm->task_size - len))
411-
return -EINVAL;
411+
return -ENOMEM;
412412

413413
/* If hint, make sure it matches our alignment restrictions */
414414
if (!fixed && addr) {

0 commit comments

Comments
 (0)