[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190118084302.GA4160@osiris>
Date: Fri, 18 Jan 2019 09:43:02 +0100
From: Heiko Carstens <heiko.carstens@...ibm.com>
To: Mike Rapoport <rppt@...ux.ibm.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Christoph Hellwig <hch@....de>,
"David S. Miller" <davem@...emloft.net>,
Dennis Zhou <dennis@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greentime Hu <green.hu@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Guan Xuetao <gxt@....edu.cn>, Guo Ren <guoren@...nel.org>,
Mark Salter <msalter@...hat.com>,
Matt Turner <mattst88@...il.com>,
Max Filippov <jcmvbkbc@...il.com>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Simek <monstr@...str.eu>,
Paul Burton <paul.burton@...s.com>,
Petr Mladek <pmladek@...e.com>, Rich Felker <dalias@...c.org>,
Richard Weinberger <richard@....at>,
Rob Herring <robh+dt@...nel.org>,
Russell King <linux@...linux.org.uk>,
Stafford Horne <shorne@...il.com>,
Tony Luck <tony.luck@...el.com>,
Vineet Gupta <vgupta@...opsys.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
devicetree@...r.kernel.org, kasan-dev@...glegroups.com,
linux-alpha@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-c6x-dev@...ux-c6x.org, linux-ia64@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, linux-s390@...r.kernel.org,
linux-sh@...r.kernel.org, linux-snps-arc@...ts.infradead.org,
linux-um@...ts.infradead.org, linux-usb@...r.kernel.org,
linux-xtensa@...ux-xtensa.org, linuxppc-dev@...ts.ozlabs.org,
openrisc@...ts.librecores.org, sparclinux@...r.kernel.org,
uclinux-h8-devel@...ts.sourceforge.jp, x86@...nel.org,
xen-devel@...ts.xenproject.org
Subject: Re: [PATCH 19/21] treewide: add checks for the return value of
memblock_alloc*()
On Wed, Jan 16, 2019 at 03:44:19PM +0200, Mike Rapoport wrote:
> 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);
>
> Signed-off-by: Mike Rapoport <rppt@...ux.ibm.com>
...
> diff --git a/arch/s390/numa/toptree.c b/arch/s390/numa/toptree.c
> index 71a608c..0118c77 100644
> --- a/arch/s390/numa/toptree.c
> +++ b/arch/s390/numa/toptree.c
> @@ -31,10 +31,14 @@ struct toptree __ref *toptree_alloc(int level, int id)
> {
> struct toptree *res;
>
> - if (slab_is_available())
> + if (slab_is_available()) {
> res = kzalloc(sizeof(*res), GFP_KERNEL);
> - else
> + } else {
> res = memblock_alloc(sizeof(*res), 8);
> + if (!res)
> + panic("%s: Failed to allocate %zu bytes align=0x%x\n",
> + __func__, sizeof(*res), 8);
> + }
> if (!res)
> return res;
Please remove this hunk, since the code _should_ be able to handle
allocation failures anyway (see end of quoted code).
Otherwise for the s390 bits:
Acked-by: Heiko Carstens <heiko.carstens@...ibm.com>
Powered by blists - more mailing lists