All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec-tools: powerpc: dt_reserve doesn't allocate enough memory for large properties
@ 2011-07-25  7:35 Anton Blanchard
  2011-07-25 11:45 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2011-07-25  7:35 UTC (permalink / raw)
  To: horms; +Cc: kexec


On a large ppc64 box I got the following error from kexec -l: 

unrecoverable error: could not read "/proc/device-tree/ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory": Bad address

dt_reserve was assuming a property was never larger than
INIT_TREE_WORDS (65536), but on this box ibm,dynamic-memory is
119995 words.

Allocate INIT_TREE_WORDS or the number of words requested, whatever
is larger.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c
index 4400f13..d2b6b18 100644
--- a/kexec/arch/ppc64/fs2dt.c
+++ b/kexec/arch/ppc64/fs2dt.c
@@ -57,9 +57,14 @@ extern int my_debug;
  */
 void dt_reserve(unsigned **dt_ptr, unsigned words)
 {
+	unsigned int sz = INIT_TREE_WORDS;
+
+	if (sz < words)
+		sz = words;
+
 	if (((*dt_ptr - dt_base) + words) >= dt_cur_size) {
 		int offset;
-		unsigned int new_size = dt_cur_size + INIT_TREE_WORDS;
+		unsigned int new_size = dt_cur_size + sz;
 		unsigned *new_dt = realloc(dt_base, new_size*4);
 
 		if (!new_dt)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] kexec-tools: powerpc: dt_reserve doesn't allocate enough memory for large properties
  2011-07-25  7:35 [PATCH] kexec-tools: powerpc: dt_reserve doesn't allocate enough memory for large properties Anton Blanchard
@ 2011-07-25 11:45 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2011-07-25 11:45 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: kexec

On Mon, Jul 25, 2011 at 05:35:42PM +1000, Anton Blanchard wrote:
> 
> On a large ppc64 box I got the following error from kexec -l: 
> 
> unrecoverable error: could not read "/proc/device-tree/ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory": Bad address
> 
> dt_reserve was assuming a property was never larger than
> INIT_TREE_WORDS (65536), but on this box ibm,dynamic-memory is
> 119995 words.
> 
> Allocate INIT_TREE_WORDS or the number of words requested, whatever

Thanks, applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2011-07-25 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25  7:35 [PATCH] kexec-tools: powerpc: dt_reserve doesn't allocate enough memory for large properties Anton Blanchard
2011-07-25 11:45 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.