From: jmarchan@redhat.com Date: Wed, 15 Jan 2014 15:27:11 +0000 (+0100) Subject: powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed... X-Git-Tag: firefly_0821_release~176^2~4515^2~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=19751c07b3728748c1253627ce94e6906fa5e273;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 7ce9cf3b6988..b0c75cc15efc 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c @@ -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) {