diff options
author | Anton Blanchard <anton@samba.org> | 2011-07-25 17:35:42 +1000 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-07-25 20:44:36 +0900 |
commit | e8b7939b1e7249aecbbe45b47c7a2a6169681072 (patch) | |
tree | 2a0ea0a34881dcaa3dda870f9ca6f6708689a999 | |
parent | 13f6d71bdf9836b90ae4ec21209383f1a3c56b0f (diff) |
kexec-tools: powerpc: dt_reserve doesn't allocate enough memory for large properties
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>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ppc64/fs2dt.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) |