kexec-tools/kexec-tools-1.101-ia64-phdr-malloc.patch
2006-12-15 21:05:01 +00:00

20 lines
761 B
Diff

--- kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c.orig 2006-11-14 13:38:45.000000000 -0500
+++ kexec-tools-1.101/kexec/arch/ia64/crashdump-ia64.c 2006-11-14 14:52:34.000000000 -0500
@@ -316,10 +316,14 @@
int nr_ranges;
size_t size;
void *tmp;
+ long int nr_cpus;
+ if ((nr_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 0)
+ return -1;
if (info->kexec_flags & KEXEC_ON_CRASH ) {
if (get_crash_memory_ranges(&mem_range, &nr_ranges) == 0) {
- size = sizeof(Elf64_Ehdr) +
- (nr_ranges + 1) * sizeof(Elf64_Phdr);
+ size = (sizeof(Elf64_Ehdr) +
+ ((nr_cpus +1) * sizeof(Elf64_Phdr)) +
+ ((nr_ranges + 1) * sizeof(Elf64_Phdr)));
size = (size + EFI_PAGE_SIZE - 1) & ~(EFI_PAGE_SIZE - 1);
tmp = xmalloc(size);
memset(tmp, 0, size);