Эх сурвалжийг харах

sh: Reject small mappings for PMB bolting.

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>
Paul Mundt 15 жил өмнө
parent
commit
dfbca89987

+ 2 - 0
arch/sh/mm/pmb.c

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