powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed...
authorjmarchan@redhat.com <jmarchan@redhat.com>
Wed, 15 Jan 2014 15:27:11 +0000 (16:27 +0100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 29 Jan 2014 06:02:25 +0000 (17:02 +1100)
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>
arch/powerpc/mm/slice.c

index 7ce9cf3b698835c0dd2b2644d137ff7549c68e72..b0c75cc15efc673a0ff8f22e0c0e6ef8dc18a038 100644 (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) {
This page took 0.041726 seconds and 5 git commands to generate.