lkml.org 
[lkml]   [2004]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] PPC64 rtas_call was calling kmalloc too early
At present rtas_call() can be called before the kmalloc subsystem is
initialized, and if RTAS reports a hardware error, the code tries to
do a kmalloc to make a copy of the error report. This patch changes
it so that we don't do the kmalloc in that situation.

Signed-off-by: Paul Mackerras <paulus@samba.org>

diff -urN akpm-18aug/arch/ppc64/kernel/rtas.c akpm/arch/ppc64/kernel/rtas.c
--- akpm-18aug/arch/ppc64/kernel/rtas.c 2004-08-03 08:07:43.000000000 +1000
+++ akpm/arch/ppc64/kernel/rtas.c 2004-08-19 15:20:22.927953816 +1000
@@ -165,9 +165,12 @@

/* Log the error in the unlikely case that there was one. */
if (unlikely(logit)) {
- buff_copy = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
- if (buff_copy) {
- memcpy(buff_copy, rtas_err_buf, RTAS_ERROR_LOG_MAX);
+ buff_copy = rtas_err_buf;
+ if (mem_init_done) {
+ buff_copy = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
+ if (buff_copy)
+ memcpy(buff_copy, rtas_err_buf,
+ RTAS_ERROR_LOG_MAX);
}
}

@@ -176,7 +179,8 @@

if (buff_copy) {
log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0);
- kfree(buff_copy);
+ if (mem_init_done)
+ kfree(buff_copy);
}
return ret;
}
diff -urN akpm-18aug/include/asm-ppc64/system.h akpm/include/asm-ppc64/system.h
--- akpm-18aug/include/asm-ppc64/system.h 2004-07-12 09:12:04.000000000 +1000
+++ akpm/include/asm-ppc64/system.h 2004-08-19 15:24:47.249973728 +1000
@@ -128,6 +128,8 @@
}
#endif

+extern int mem_init_done; /* set on boot once kmalloc can be called */
+
/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
extern unsigned char e2a(unsigned char);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.032 / U:1.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site