summaryrefslogtreecommitdiff
path: root/kexec
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2009-01-08 06:33:50 -0600
committerSimon Horman <horms@verge.net.au>2009-01-16 09:41:05 +1100
commite8f2de09b52c3f4e23f907a6f6bf837b1f45af50 (patch)
tree5f5cb8d856662a5041b9b4867c244c3546dcce56 /kexec
parent14f69fc20bec03f7db1c4f4c0e45d9e73400e9a5 (diff)
ppc64: always check number of ranges when adding them
make the idom "always call realloc_memory_ranges when filling a range entry" kexec was core dumping after using 5 exclude_range pairs when only 3 were allocated. also delcare realloc_memory_ranges to take void. Signed-off-by: Milton Miller <miltonm@bga.com> Tested-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/arch/ppc64/kexec-ppc64.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index f60c9ec..d8347f1 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -96,7 +96,7 @@ err1:
}
-static int realloc_memory_ranges()
+static int realloc_memory_ranges(void)
{
size_t memory_range_len;
@@ -469,6 +469,8 @@ static int get_devtree_details(unsigned long kexec_flags)
exclude_range[i].start = initrd_start;
exclude_range[i].end = initrd_end;
i++;
+ if (i >= max_memory_ranges)
+ realloc_memory_ranges();
}
} /* chosen */
@@ -581,6 +583,8 @@ static int get_devtree_details(unsigned long kexec_flags)
exclude_range[i].start = tce_base;
exclude_range[i].end = tce_base + tce_size;
i++;
+ if (i >= max_memory_ranges)
+ realloc_memory_ranges();
if (kexec_flags & KEXEC_ON_CRASH)
add_usable_mem_rgns(tce_base, tce_size);
closedir(cdir);
@@ -634,6 +638,8 @@ int setup_memory_ranges(unsigned long kexec_flags)
memory_range[j].end = exclude_range[i].start - 1;
memory_range[j].type = RANGE_RAM;
j++;
+ if (j >= max_memory_ranges)
+ realloc_memory_ranges();
}
} /* i == 0 */
/* If the last exclude range does not end at memory_max, include
@@ -646,6 +652,8 @@ int setup_memory_ranges(unsigned long kexec_flags)
memory_range[j].end = memory_max;
memory_range[j].type = RANGE_RAM;
j++;
+ if (j >= max_memory_ranges)
+ realloc_memory_ranges();
/* Limit the end to rmo_top */
if (memory_range[j-1].start >= rmo_top) {
j--;
@@ -666,6 +674,8 @@ int setup_memory_ranges(unsigned long kexec_flags)
memory_range[j].end = exclude_range[i+1].start - 1;
memory_range[j].type = RANGE_RAM;
j++;
+ if (j >= max_memory_ranges)
+ realloc_memory_ranges();
/* Limit range to rmo_top */
if (memory_range[j-1].start >= rmo_top) {
j--;