Move check for TASK_SIZE before MAP_FIXED in sh's arch_get_unmapped_area() and arch_get_unmapped_area_topdown(). Signed-off-by: Vladimir Murzin <murzin.v@xxxxxxxxx> --- arch/sh/mm/mmap.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c index afeb710..2c61159 100644 --- a/arch/sh/mm/mmap.c +++ b/arch/sh/mm/mmap.c @@ -50,6 +50,9 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long start_addr; int do_colour_align; + if (unlikely(len > TASK_SIZE)) + return -ENOMEM; + if (flags & MAP_FIXED) { /* We do not accept a shared mapping if it would violate * cache aliasing constraints. @@ -60,9 +63,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, return addr; } - if (unlikely(len > TASK_SIZE)) - return -ENOMEM; - do_colour_align = 0; if (filp || (flags & MAP_SHARED)) do_colour_align = 1; @@ -132,6 +132,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, unsigned long addr = addr0; int do_colour_align; + if (unlikely(len > TASK_SIZE)) + return -ENOMEM; + if (flags & MAP_FIXED) { /* We do not accept a shared mapping if it would violate * cache aliasing constraints. @@ -142,9 +145,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, return addr; } - if (unlikely(len > TASK_SIZE)) - return -ENOMEM; - do_colour_align = 0; if (filp || (flags & MAP_SHARED)) do_colour_align = 1; -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html