public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix CONFIG_NOHIGHMEM for extended crashkernel command line
@ 2007-09-25  6:55 Bernhard Walle
  2007-09-25  7:06 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Walle @ 2007-09-25  6:55 UTC (permalink / raw)
  To: akpm; +Cc: Laurent Riffard, linux-kernel

This patch fixes a build error with CONFIG_KEXEC=y and CONFIG_NOHIGHMEM=y.

linux-2.6-mm$ LANG=C make
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/linux/compile.h
  CC      arch/i386/kernel/setup.o
arch/i386/kernel/setup.c: In function 'reserve_crashkernel':
arch/i386/kernel/setup.c:391: error: 'highend_pfn' undeclared (first use in this function)
arch/i386/kernel/setup.c:391: error: (Each undeclared identifier is reported only once
arch/i386/kernel/setup.c:391: error: for each function it appears in.)
arch/i386/kernel/setup.c:391: error: 'highstart_pfn' undeclared (first use in this function)
make[1]: *** [arch/i386/kernel/setup.o] Error 1
make: *** [arch/i386/kernel] Error 2


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 arch/i386/kernel/setup.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -381,6 +381,20 @@ extern unsigned long __init setup_memory
 extern void zone_sizes_init(void);
 #endif /* !CONFIG_NEED_MULTIPLE_NODES */
 
+
+#ifdef CONFIG_HIGHMEM
+static inline unsigned long long get_total_mem(void)
+{
+	return (max_low_pfn + highend_pfn - highstart_pfn) << PAGE_SHIFT;
+}
+#else
+static inline unsigned long long get_total_mem(void)
+{
+	return max_low_pfn << PAGE_SHIFT;
+}
+#endif
+
+
 #ifdef CONFIG_KEXEC
 static void __init reserve_crashkernel(void)
 {
@@ -388,7 +402,7 @@ static void __init reserve_crashkernel(v
 	unsigned long long 	crash_size, crash_base;
 	int			ret;
 
-	free_mem = (max_low_pfn + highend_pfn - highstart_pfn) << PAGE_SHIFT;
+	free_mem = get_total_mem();
 
 	ret = parse_crashkernel(boot_command_line, free_mem,
 			&crash_size, &crash_base);

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

* Re: [PATCH] Fix CONFIG_NOHIGHMEM for extended crashkernel command line
  2007-09-25  6:55 [PATCH] Fix CONFIG_NOHIGHMEM for extended crashkernel command line Bernhard Walle
@ 2007-09-25  7:06 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-09-25  7:06 UTC (permalink / raw)
  To: Bernhard Walle; +Cc: Laurent Riffard, linux-kernel

On Tue, 25 Sep 2007 08:55:29 +0200 Bernhard Walle <bwalle@suse.de> wrote:

> @@ -381,6 +381,20 @@ extern unsigned long __init setup_memory
>  extern void zone_sizes_init(void);
>  #endif /* !CONFIG_NEED_MULTIPLE_NODES */
>  
> +

Only one line is needed between functions, please.

> +#ifdef CONFIG_HIGHMEM
> +static inline unsigned long long get_total_mem(void)
> +{
> +	return (max_low_pfn + highend_pfn - highstart_pfn) << PAGE_SHIFT;
> +}
> +#else
> +static inline unsigned long long get_total_mem(void)
> +{
> +	return max_low_pfn << PAGE_SHIFT;
> +}
> +#endif
> +
> +

Full of bugs.  (unsigned long << foo) returns an unsigned long.  With >4G
there will be truncation.

Please review the full patchset for other occurrences of this.

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

end of thread, other threads:[~2007-09-25  7:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-25  6:55 [PATCH] Fix CONFIG_NOHIGHMEM for extended crashkernel command line Bernhard Walle
2007-09-25  7:06 ` Andrew Morton

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