[PATCH 5/6] Add checks to detect overlap of memory regions.

Andreas Fenkart andreas.fenkart at streamunlimited.com
Thu Oct 1 06:49:00 EDT 2009


Signed-off-by: Andreas Fenkart <andreas.fenkart at streamunlimited.com>
---
 arch/arm/mm/init.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 4685611..5c1a69c 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -666,6 +666,26 @@ void __init mem_init(void)
 #undef MLM
 #undef MLK_ROUNDUP
 
+	/*
+	 * Check boundaries twice: Some fundamental inconsistencies can
+	 * be detected at build time already.
+	 */
+	BUILD_BUG_ON(VMALLOC_START			>= VMALLOC_END);
+	BUG_ON(VMALLOC_START				>= VMALLOC_END);
+
+#ifdef CONFIG_MMU
+	BUILD_BUG_ON(VMALLOC_END			> CONSISTENT_BASE);
+	BUG_ON(VMALLOC_END				> CONSISTENT_BASE);
+
+	BUILD_BUG_ON(TASK_SIZE 			> MODULES_VADDR);
+	BUG_ON(TASK_SIZE 				> MODULES_VADDR);
+#endif
+
+#ifdef CONFIG_HIGHMEM
+	BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
+	BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE	> PAGE_OFFSET);
+#endif
+
 	if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
 		extern int sysctl_overcommit_memory;
 		/*
-- 
1.6.4.3




More information about the linux-arm-kernel mailing list