1
0
Fork 0
alistair23-linux/arch/um/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
..
skas um: Remove unnecessary faulted check in uaccess.c 2018-12-27 22:48:20 +01:00
Makefile um: Support kcov 2016-08-04 00:18:06 +02:00
asm-offsets.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
config.c.in um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
dyn.lds.S Construct init thread stack in the linker script rather than by union 2018-01-09 23:21:02 +00:00
early_printk.c early_printk: consolidate random copies of identical code 2013-04-29 18:28:13 -07:00
exec.c sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
exitcode.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
gmon_syms.c um: Fix CONFIG_GCOV for modules. 2017-09-13 22:33:54 +02:00
gprof_syms.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
initrd.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
irq.c um: Remove obsolete reenable_XX calls 2018-12-27 22:48:35 +01:00
kmsg_dump.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ksyms.c um: Move syscall() declaration into os.h 2015-05-31 13:14:07 +02:00
maccess.c um: Implement probe_kernel_read() 2013-09-07 10:38:34 +02:00
mem.c treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
physmem.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
process.c um: Fix FP register size for XSTATE/XSAVE 2017-09-13 22:24:38 +02:00
ptrace.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
reboot.c sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
sigio.c um: Remove obsolete reenable_XX calls 2018-12-27 22:48:35 +01:00
signal.c Revert "um: Fix get_signal() usage" 2016-03-05 22:16:40 +01:00
stacktrace.c um: Add support for CONFIG_STACKTRACE 2014-10-13 21:46:25 +02:00
syscall.c mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
sysrq.c um: Fix _print_addr() 2017-05-03 22:30:20 +02:00
time.c um: time: Use timespec64 for persistent clock 2018-02-19 19:38:51 +01:00
tlb.c um: Optimize Flush TLB for force/fork case 2018-12-27 22:48:34 +01:00
trap.c um: trap: fix spelling mistake, EACCESS -> EACCES 2018-10-29 22:34:15 +01:00
um_arch.c Construct init thread stack in the linker script rather than by union 2018-01-09 23:21:02 +00:00
umid.c um: Use os_warn to print out pre-boot warning/error messages 2017-07-05 23:18:25 +02:00
uml.lds.S Construct init thread stack in the linker script rather than by union 2018-01-09 23:21:02 +00:00
vmlinux.lds.S arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0 2009-09-20 12:28:22 +02:00