[PATCH v1 7/7] crashdump/x86: utilize get_elfcorehdrsz()

Eric DeVolder eric.devolder at oracle.com
Thu Oct 20 10:03:44 PDT 2022


Call get_elfcorehdrsz() to obtain the size of the elfcorehdr
buffer.

Signed-off-by: Eric DeVolder <eric.devolder at oracle.com>
---
 kexec/arch/i386/crashdump-x86.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index cb86ca7..29d4ba5 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -957,6 +957,12 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 		memsz = bufsz;
 	}
 
+	/* Adjust size of buffer according to hotplug and user */
+	sz = get_elfcorehdrsz(&elf_info, bufsz, CRASH_MAX_MEMORY_RANGES);
+	if (sz > memsz)
+		memsz = sz;
+	memsz = _ALIGN(memsz, align);
+
 	/* Record the location of the elfcorehdr for hotplug handling */
 	info->elfcorehdr =
 	elfcorehdr = add_buffer(info, tmp, bufsz, memsz, align, min_base,
-- 
2.31.1




More information about the kexec mailing list