Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2885833imu; Fri, 18 Jan 2019 00:45:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN4TTsmjOoBEgd4KHSqT4K/jSGf+lHtXcvKzt3GvbGF57kk/BRi2nbydQPqqPA6zGHqpBFAk X-Received: by 2002:a65:4646:: with SMTP id k6mr11938070pgr.153.1547801147192; Fri, 18 Jan 2019 00:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547801147; cv=none; d=google.com; s=arc-20160816; b=vd59qmA3Vf/3TaB/a6r310ETUAkA3aWH91+8MDAr90IcUIg1vFRyG0ocN/MS9wIcCG twWEOIaduKCmdcp7XnBUTJC+KggIFIbbs0D2OWLcxrSxOZ4RDyEkRBwXbVYsd7ythT3W TbHn1KZpmzke6W/ByBKFd8L+WHCnBLX5mi4RXkGUO40qPV7USC5AsecdzR4q03hWwQu8 5MdGw+gBhaSnbEmNhDepMW7ixQOpyd69rKB2T+SgoEjqMe691C15bnzfGdh6qOocjCpO knGRlChvssN6NT9SuwpfG8lGomBDvFwyKh7WBfazbmSgpff2NtV0Mt3wdFiYw6Jh9+8N UMWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:message-id:in-reply-to:mime-version :references:subject:cc:to:from:date; bh=oiUsAhGkPKdMPsvcLSXnhm/jcougxDJyxpr1arRVp7Q=; b=JakZrj4zs2XQrdWSdQ9xh1JWqvzDD2fjVKjlzjO5iKuymwFb94MTiblPFRyrRFCYsC B4lIOil+Idy7JAcpMMzLH79McdwDgjj71EthYqOkJKN1wR05d4tg44BF1ldVBCuOzG2n xzCSmT0L3t8Qati9FcrgzttM1VbVTom+Gv9IEt1q5l8ZVdFfege1wTs4pBH5LLqFmSgA DFnD/ttgWE7bERQcci36O/rsdvw57KKemNHZzATQtSwRTtwYSR6IcasAuGGFg9S5565K j6VN9Hp/9QcLEx1gJV948f4bSB9+4vnWxCW2GGMa4EgWY35tc3oIsxEBciYx/j9GT05x FAkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si4212568pfe.4.2019.01.18.00.45.31; Fri, 18 Jan 2019 00:45:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727633AbfARInZ (ORCPT + 99 others); Fri, 18 Jan 2019 03:43:25 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39588 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbfARInW (ORCPT ); Fri, 18 Jan 2019 03:43:22 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0I8ctHL109360 for ; Fri, 18 Jan 2019 03:43:21 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q38a1y8ep-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Jan 2019 03:43:21 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 18 Jan 2019 08:43:18 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 18 Jan 2019 08:43:05 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0I8h4Ht64487672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Jan 2019 08:43:04 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9F0011C052; Fri, 18 Jan 2019 08:43:04 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C8A411C058; Fri, 18 Jan 2019 08:43:03 +0000 (GMT) Received: from osiris (unknown [9.152.212.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 18 Jan 2019 08:43:03 +0000 (GMT) Date: Fri, 18 Jan 2019 09:43:02 +0100 From: Heiko Carstens To: Mike Rapoport Cc: linux-mm@kvack.org, Andrew Morton , Catalin Marinas , Christoph Hellwig , "David S. Miller" , Dennis Zhou , Geert Uytterhoeven , Greentime Hu , Greg Kroah-Hartman , Guan Xuetao , Guo Ren , Mark Salter , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Paul Burton , Petr Mladek , Rich Felker , Richard Weinberger , Rob Herring , Russell King , Stafford Horne , Tony Luck , Vineet Gupta , Yoshinori Sato , devicetree@vger.kernel.org, kasan-dev@googlegroups.com, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-usb@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH 19/21] treewide: add checks for the return value of memblock_alloc*() References: <1547646261-32535-1-git-send-email-rppt@linux.ibm.com> <1547646261-32535-20-git-send-email-rppt@linux.ibm.com> MIME-Version: 1.0 In-Reply-To: <1547646261-32535-20-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011808-4275-0000-0000-00000300D9EE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011808-4276-0000-0000-0000380F012F Message-Id: <20190118084302.GA4160@osiris> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-18_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901180066 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ... > 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