1
0
Fork 0
alistair23-linux/arch/unicore32/kernel
Mike Rapoport 8a7f97b902 treewide: add checks for the return value of memblock_alloc*()
Add check for the return value of memblock_alloc*() functions and call
panic() in case of error.  The panic message repeats the one used by
panicing memblock allocators with adjustment of parameters to include
only relevant ones.

The replacement was mostly automated with semantic patches like the one
below with manual massaging of format strings.

  @@
  expression ptr, size, align;
  @@
  ptr = memblock_alloc(size, align);
  + if (!ptr)
  + 	panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align);

[anders.roxell@linaro.org: use '%pa' with 'phys_addr_t' type]
  Link: http://lkml.kernel.org/r/20190131161046.21886-1-anders.roxell@linaro.org
[rppt@linux.ibm.com: fix format strings for panics after memblock_alloc]
  Link: http://lkml.kernel.org/r/1548950940-15145-1-git-send-email-rppt@linux.ibm.com
[rppt@linux.ibm.com: don't panic if the allocation in sparse_buffer_init fails]
  Link: http://lkml.kernel.org/r/20190131074018.GD28876@rapoport-lnx
[akpm@linux-foundation.org: fix xtensa printk warning]
Link: http://lkml.kernel.org/r/1548057848-15136-20-git-send-email-rppt@linux.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Guo Ren <ren_guo@c-sky.com>		[c-sky]
Acked-by: Paul Burton <paul.burton@mips.com>		[MIPS]
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>	[s390]
Reviewed-by: Juergen Gross <jgross@suse.com>		[Xen]
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>	[m68k]
Acked-by: Max Filippov <jcmvbkbc@gmail.com>		[xtensa]
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Guo Ren <guoren@kernel.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-03-12 10:04:02 -07:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
asm-offsets.c unicore32: Remove signal translation and exec_domain 2015-04-12 21:03:28 +02:00
clock.c arch/unicore32/kernel/clock.c: add readl() and writel() for 'PM_' macros 2014-06-20 08:22:37 +08:00
debug-macro.S unicore32 additional architecture files: low-level lib: ocd debug 2011-03-17 09:19:12 +08:00
debug.S unicore32 additional architecture files: low-level lib: ocd debug 2011-03-17 09:19:12 +08:00
dma.c Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
early_printk.c arch/unicore32/kernel/early_printk.c:setup_early_printk: missing initialization 2014-01-27 21:02:39 -08:00
elf.c unicore32 core architecture: generic elf and ksyms stuff 2011-03-17 09:19:05 +08:00
entry.S unicore32: switch to generic sigaltstack 2013-02-03 18:16:23 -05:00
fpu-ucf64.c signal/unicore32: Use send_sig_fault where appropriate 2018-09-27 21:59:44 +02:00
gpio.c unicore32: use the new LED disk activity trigger 2016-06-27 08:58:42 +02:00
head.S Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] 2012-03-28 18:30:03 +01:00
hibernate.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
hibernate_asm.S unicore32 additional architecture files: pm related files 2011-03-17 09:19:11 +08:00
irq.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
ksyms.c unicore32: get rid of zeroing and switch to RAW_COPY_USER 2017-03-28 18:24:04 -04:00
ksyms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module.c mm: vmalloc: pass additional vm_flags to __vmalloc_node_range() 2015-02-13 21:21:42 -08:00
pci.c unicore32/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks 2017-08-03 16:29:34 -05:00
pm.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
process.c unicore32: do not use print_symbol() 2018-01-05 15:21:10 +01:00
ptrace.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
puv3-core.c platform: Remove most references to platform_bus device 2014-07-23 19:09:03 -07:00
puv3-nb0916.c unicore32: nb0916: Use PWM lookup table 2015-11-10 13:06:44 +01:00
setup.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
setup.h reboot: unicore32: prepare reboot_mode for moving to generic kernel code 2013-07-09 10:33:29 -07:00
signal.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
sleep.S unicore32: modify io_p2v and io_v2p macros, and adjust PKUNITY_mmio_BASEs 2011-03-17 09:19:21 +08:00
stacktrace.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h> 2017-03-02 08:42:34 +01:00
sys.c unicore32: just use mmap_pgoff()... 2013-05-09 14:10:07 -04:00
time.c unicore32/time: Set ->min_delta_ticks and ->max_delta_ticks 2017-04-14 13:11:22 -07:00
traps.c signal/unicore32: Generate siginfo in ucs32_notify_die 2018-09-27 22:11:28 +02:00
vmlinux.lds.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00