[PATCH] kexec/arch/ppc/fixup_dtb.c: Calcuate new FDT size correctly

Matthew McClintock msm at freescale.com
Tue Sep 21 18:58:51 EDT 2010


It was possible to not add enough space when we allocate
more space for more memory reserve regions, this was because
we were incorrectly accounting for the size of a reserve
region. This corrects the assumed size for a resize region

Signed-off-by: Matthew McClintock <msm at freescale.com>
---
 kexec/arch/ppc/fixup_dtb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 205fd77..29e428c 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -354,7 +354,8 @@ char *fixup_dtb_init(struct kexec_info *info, char *blob_buf, off_t *blob_size,
 		printf("%s: Unable to pack flat device tree\n", fdt_strerror(ret));
 
 	/* info->nr_segments just a guide, will grow by at least EXPAND_GRANULARITY */
-	blob_buf = expand_buf(info->nr_segments, blob_buf, blob_size);
+	blob_buf = expand_buf(info->nr_segments * sizeof(struct fdt_reserve_entry),
+				 blob_buf, blob_size);
 
 	/* add reserve region for *THIS* fdt */
 	*dtb_addr = locate_hole(info, *blob_size, 0,
-- 
1.6.0.6





More information about the kexec mailing list