]> Pileus Git - ~andy/linux/commitdiff
sh: Reject small mappings for PMB bolting.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 11 May 2010 04:50:29 +0000 (13:50 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 11 May 2010 04:50:29 +0000 (13:50 +0900)
The minimum section size for the PMB is 16M, so just always error
out early if the specified size is too small. This permits us to
unconditionally call in to pmb_bolt_mapping() with variable sizes
without wasting a TLB and cache flush for the range.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/mm/pmb.c

index e9f5384f3f1c6988ecd056f8253a6f3bd24ceef4..18623ba751b32e3863094bae05bcf44d58141f4b 100644 (file)
@@ -341,6 +341,8 @@ int pmb_bolt_mapping(unsigned long vaddr, phys_addr_t phys,
        unsigned long flags, pmb_flags;
        int i, mapped;
 
+       if (size < SZ_16M)
+               return -EINVAL;
        if (!pmb_addr_valid(vaddr, size))
                return -EFAULT;
        if (pmb_mapping_exists(vaddr, phys, size))