From 27c281a41ff7243ae98dcebdeedd407fb45d129d Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Wed, 13 Jul 2011 12:39:33 -0700 Subject: [PATCH] msm: Don't allow overmapping Due to the way allocations are performed, over mapping must be disallowed. Otherwise, it may be possible to inadvertently unmap other physical addresses. The smallest length that can now be mapped is 4K. Lengths less than 4k can be safely overmapped since physical addresses must be 4k aligned as well. Change-Id: I897f479c0cec29d499406b52b624a6f2b34b718a Signed-off-by: Laura Abbott --- arch/arm/mach-msm/subsystem_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-msm/subsystem_map.c b/arch/arm/mach-msm/subsystem_map.c index 307531b6470..82f2b6617cc 100644 --- a/arch/arm/mach-msm/subsystem_map.c +++ b/arch/arm/mach-msm/subsystem_map.c @@ -353,7 +353,7 @@ struct msm_mapped_buffer *msm_subsystem_map_buffer(unsigned long phys, pg_size = SZ_4K; for (i = 0; i < ARRAY_SIZE(iommu_page_sizes); i++) { - if ((length > iommu_page_sizes[i]) && + if (IS_ALIGNED(length, iommu_page_sizes[i]) && IS_ALIGNED(phys, iommu_page_sizes[i])) { pg_size = iommu_page_sizes[i]; break;