summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPhilipp Rudo <prudo@linux.ibm.com>2018-08-13 12:45:06 +0200
committerHeiko Carstens <heiko.carstens@de.ibm.com>2018-08-16 14:49:15 +0200
commit28b7465376b9f9633bb774e45c0421dc4db7f303 (patch)
tree272f390e448080aba50b7194bc011359fea77568 /arch
parent2d2e7075b87181ed0c675e4936e20bdadba02e1f (diff)
downloadlinux-stable-28b7465376b9f9633bb774e45c0421dc4db7f303.tar.gz
linux-stable-28b7465376b9f9633bb774e45c0421dc4db7f303.tar.bz2
linux-stable-28b7465376b9f9633bb774e45c0421dc4db7f303.zip
s390/kdump: Remove kzalloc_panic
For this function there are only two users, when 1) the elfcorehdr and 2) the vmcoreinfo is allocated. However a missing vmcoreinfo is not critical for kdump. So panicking when it cannot be allocated is not required. Remove kzalloc_panic and adjust its callers accordingly. Signed-off-by: Philipp Rudo <prudo@linux.ibm.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/crash_dump.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 27d2b7093ea0..376f6b6dfb3c 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -293,19 +293,6 @@ int remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from,
prot);
}
-/*
- * Alloc memory and panic in case of ENOMEM
- */
-static void *kzalloc_panic(int len)
-{
- void *rc;
-
- rc = kzalloc(len, GFP_KERNEL);
- if (!rc)
- panic("s390 kdump kzalloc (%d) failed", len);
- return rc;
-}
-
static const char *nt_name(Elf64_Word type)
{
const char *name = "LINUX";
@@ -453,7 +440,9 @@ static void *get_vmcoreinfo_old(unsigned long *size)
return NULL;
if (strcmp(nt_name, VMCOREINFO_NOTE_NAME) != 0)
return NULL;
- vmcoreinfo = kzalloc_panic(note.n_descsz);
+ vmcoreinfo = kzalloc(note.n_descsz, GFP_KERNEL);
+ if (!vmcoreinfo)
+ return NULL;
if (copy_oldmem_kernel(vmcoreinfo, addr + 24, note.n_descsz)) {
kfree(vmcoreinfo);
return NULL;
@@ -661,7 +650,15 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size)
alloc_size = get_elfcorehdr_size(mem_chunk_cnt);
- hdr = kzalloc_panic(alloc_size);
+ hdr = kzalloc(alloc_size, GFP_KERNEL);
+
+ /* Without elfcorehdr /proc/vmcore cannot be created. Thus creating
+ * a dump with this crash kernel will fail. Panic now to allow other
+ * dump mechanisms to take over.
+ */
+ if (!hdr)
+ panic("s390 kdump allocating elfcorehdr failed");
+
/* Init elf header */
ptr = ehdr_init(hdr, mem_chunk_cnt);
/* Init program headers */