mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i386: add some compile time checks to mem_init()
@ 2008-12-16 11:45 Jan Beulich
  2008-12-16 17:43 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2008-12-16 11:45 UTC (permalink / raw)
  To: mingo, tglx, hpa; +Cc: linux-kernel

Some of the inconsistencies checked for at run time can be detected at
build time already, so duplicate the checks done at run time to also be
done at build time.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 arch/x86/mm/init_32.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- linux-2.6.28-rc8/arch/x86/mm/init_32.c	2008-12-11 14:36:52.000000000 +0100
+++ 2.6.28-rc8-i386-mem-init-build-check/arch/x86/mm/init_32.c	2008-12-15 11:35:43.000000000 +0100
@@ -1040,11 +1040,25 @@ void __init mem_init(void)
 		(unsigned long)&_text, (unsigned long)&_etext,
 		((unsigned long)&_etext - (unsigned long)&_text) >> 10);
 
+	/*
+	 * Check boundaries twice: Some fundamental inconsistencies can
+	 * be detected at build time already.
+	 */
+#define __FIXADDR_TOP (-PAGE_SIZE)
+#ifdef CONFIG_HIGHMEM
+	BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE	> FIXADDR_START);
+	BUILD_BUG_ON(VMALLOC_END			> PKMAP_BASE);
+#endif
+#define high_memory (-128UL << 20)
+	BUILD_BUG_ON(VMALLOC_START			>= VMALLOC_END);
+#undef high_memory
+#undef __FIXADDR_TOP
+
 #ifdef CONFIG_HIGHMEM
 	BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE	> FIXADDR_START);
 	BUG_ON(VMALLOC_END				> PKMAP_BASE);
 #endif
-	BUG_ON(VMALLOC_START				> VMALLOC_END);
+	BUG_ON(VMALLOC_START				>= VMALLOC_END);
 	BUG_ON((unsigned long)high_memory		> VMALLOC_START);
 
 	if (boot_cpu_data.wp_works_ok < 0)




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i386: add some compile time checks to mem_init()
  2008-12-16 11:45 [PATCH] i386: add some compile time checks to mem_init() Jan Beulich
@ 2008-12-16 17:43 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-12-16 17:43 UTC (permalink / raw)
  To: Jan Beulich; +Cc: tglx, hpa, linux-kernel


* Jan Beulich <jbeulich@novell.com> wrote:

> Some of the inconsistencies checked for at run time can be detected at
> build time already, so duplicate the checks done at run time to also be
> done at build time.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> ---
>  arch/x86/mm/init_32.c |   16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)

applied to tip/x86/debug - thanks,

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-16 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16 11:45 [PATCH] i386: add some compile time checks to mem_init() Jan Beulich
2008-12-16 17:43 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®