From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E57BBC169C4 for ; Thu, 31 Jan 2019 06:07:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D12B218AF for ; Thu, 31 Jan 2019 06:07:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=c-s.fr header.i=@c-s.fr header.b="PPRKteYu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D12B218AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=c-s.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E3258E0002; Thu, 31 Jan 2019 01:07:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 191C28E0001; Thu, 31 Jan 2019 01:07:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 032308E0002; Thu, 31 Jan 2019 01:07:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by kanga.kvack.org (Postfix) with ESMTP id 9C4F28E0001 for ; Thu, 31 Jan 2019 01:07:51 -0500 (EST) Received: by mail-wm1-f71.google.com with SMTP id f198so557683wmd.4 for ; Wed, 30 Jan 2019 22:07:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=NCah7PD0r/noHO/Uh52qxtNlyFWpGoyRnjJU9LYwodw=; b=jYyCf5puw2PCoWMn8bmrpKHuVIYkqsn+uzEz3WWYxTo7iXVHbc8JvOR6gJK7f6ek/x JB8qr/mrqMXR+3NPV8zQr+8LRDQsd4P4CPZnop0eqN6aDIhPN5xuQlDfDxtY94eU45tz OKr3RwTNH1bZlEFb4VbUCJsxn6/IX/V+3RDj9p/C4gdwJ1fMAXhfstxO7XY3EkSe6Owf 1FBP4eZIFf/S0PwW0jkMkAw2cSJh0WClyW2b2ptniJa9H8w0OBSxu8+E+IawUX8Ji3Ks 4ZH8he1EjDLHAiMOrMiwQaPnDRxjawOdyhv78E+0OelCzcHQsKyArTZH4qPWnR2tQPu6 uPoQ== X-Gm-Message-State: AJcUukdp/LPCGtz2v2I1uTPtwN63yeX2U5N+JiXtrmr2TqkLLs9jcpfA j4NW47N1Ky+sjkuh9+HA3bZKq/YJNtS9f8GTnREv9gjPz7M2RDn/xQL+ZMXCCgL86nhkjaFUnQS pmV45Us1ukHkYi04C9L1Gta1FRGQ9qOfpoxzB1nB8FnnMhmNYTmJlcNvsTCTlipRXCg== X-Received: by 2002:a7b:c5d1:: with SMTP id n17mr21656973wmk.152.1548914871100; Wed, 30 Jan 2019 22:07:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN4XOKsOTVdVafWGddZYvZyj0sbDpyZFyWd5yOJpABNJwWznfEfIBg6YnGrZIdGoaLWbmP+o X-Received: by 2002:a7b:c5d1:: with SMTP id n17mr21656918wmk.152.1548914870055; Wed, 30 Jan 2019 22:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548914870; cv=none; d=google.com; s=arc-20160816; b=t2a9olJ3Jr0zm9JzX4mZTvc31gXt9MhZgr/bZS+VRRgk8PruBJIGo10KsClAT+CX82 ZwClJ0BtL7jIo2/QLOU+/YhHMyubc/i+smQqW+WKAxvxmOC6wPRsNZQCGReiyB5Chta8 k2KOK+t2GE9h2z7bbF0ImWqUjkgttfMUOlq6mF2kDXNLIdVvtNipTUrmUXlwn40bDBYA giRpzjIb4UNbVALIS9KbDzGrc7D+L7EPDRJ0SpC/jQaEipwbjpZqjrVyGzPqFW4ZGa4S Mb1GM/AI/pFdvXRFeNKnIJqD5/hLuitRnyqRJdPY4pJWGgtGMyiUld3uMg7Tz6q34xZ5 f6gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :dkim-signature; bh=NCah7PD0r/noHO/Uh52qxtNlyFWpGoyRnjJU9LYwodw=; b=hdxhRDTUcOxUMC9tgKi3iKqMR4JYlzQpZAkDAIdB28OcglBGz149xx3LiTXREf1338 OEnvhD4XJh4Mnw4A6c74dOXk5rStONCUmuVu0Wuq9Chrp7aV4+ky+ByeElPfMGvz8CII RacaNZXva8if5xDkYmxUeOmaPWA7Dh5y6nC8J130eyXOsKlCFe4RGZlrY1dA19oQ1Qa8 Ivxoifajgy1JAAch4xVPvOYAqfGvk3jFfd5bsJALsbaKaUcKZeXWljQD5cz5JSksolVE xPZr2DH79U8YO38NhmSJ5BBqjHv1OT86uoWGQ0D6YmRxGCR8DH8AIHwvWMblY0QO8CYS 385A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=PPRKteYu; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from pegase1.c-s.fr (pegase1.c-s.fr. [93.17.236.30]) by mx.google.com with ESMTPS id o19si2825854wmh.19.2019.01.30.22.07.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 22:07:49 -0800 (PST) Received-SPF: pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) client-ip=93.17.236.30; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=PPRKteYu; spf=pass (google.com: domain of christophe.leroy@c-s.fr designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@c-s.fr Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43qqXN2zD6z9v0y2; Thu, 31 Jan 2019 07:07:48 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=PPRKteYu; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 8eQljt9yKxMk; Thu, 31 Jan 2019 07:07:48 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43qqXN19Kmz9v0y0; Thu, 31 Jan 2019 07:07:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1548914868; bh=NCah7PD0r/noHO/Uh52qxtNlyFWpGoyRnjJU9LYwodw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PPRKteYuUZeYij8URy8Yi6SlDuWnapGXe+mGP4EjcgzMqqNP8EZdSP5FNVjPYInsT 1SLAJFU3/5dHTmUUvReCIz9Epq15HGwbyMCJ7xsQ51aFHaQlJbFmKmOks3EsEBfY8B rAbHZg9+ub3vVM8gaD3FsZGuNpYhHL+xUNVYs/Xg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E31D88B78D; Thu, 31 Jan 2019 07:07:48 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id UCr4ES66h6TH; Thu, 31 Jan 2019 07:07:48 +0100 (CET) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8FD748B74C; Thu, 31 Jan 2019 07:07:46 +0100 (CET) Subject: Re: [PATCH v2 19/21] treewide: add checks for the return value of memblock_alloc*() To: Mike Rapoport , linux-mm@kvack.org Cc: Rich Felker , linux-ia64@vger.kernel.org, devicetree@vger.kernel.org, Catalin Marinas , Heiko Carstens , x86@kernel.org, linux-mips@vger.kernel.org, Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Christoph Hellwig , linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Richard Weinberger , linux-sh@vger.kernel.org, Russell King , kasan-dev@googlegroups.com, Geert Uytterhoeven , Mark Salter , Dennis Zhou , Matt Turner , linux-snps-arc@lists.infradead.org, uclinux-h8-devel@lists.sourceforge.jp, Petr Mladek , linux-xtensa@linux-xtensa.org, linux-alpha@vger.kernel.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, Rob Herring , Greentime Hu , xen-devel@lists.xenproject.org, Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Michal Simek , Tony Luck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Burton , Vineet Gupta , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , openrisc@lists.librecores.org, Stephen Rothwell References: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com> <1548057848-15136-20-git-send-email-rppt@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Thu, 31 Jan 2019 07:07:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1548057848-15136-20-git-send-email-rppt@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Le 21/01/2019 à 09:04, Mike Rapoport a écrit : > 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 > Reviewed-by: Guo Ren # c-sky > Acked-by: Paul Burton # MIPS > Acked-by: Heiko Carstens # s390 > Reviewed-by: Juergen Gross # Xen > --- [...] > diff --git a/mm/sparse.c b/mm/sparse.c > index 7ea5dc6..ad94242 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c [...] > @@ -425,6 +436,10 @@ static void __init sparse_buffer_init(unsigned long size, int nid) > memblock_alloc_try_nid_raw(size, PAGE_SIZE, > __pa(MAX_DMA_ADDRESS), > MEMBLOCK_ALLOC_ACCESSIBLE, nid); > + if (!sparsemap_buf) > + panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx\n", > + __func__, size, PAGE_SIZE, nid, __pa(MAX_DMA_ADDRESS)); > + memblock_alloc_try_nid_raw() does not panic (help explicitly says: Does not zero allocated memory, does not panic if request cannot be satisfied.). Stephen Rothwell reports a boot failure due to this change. Christophe > sparsemap_buf_end = sparsemap_buf + size; > } > >