From patchwork Sun Apr 14 04:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10899685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19B1F17E6 for ; Sun, 14 Apr 2019 04:56:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E358528A57 for ; Sun, 14 Apr 2019 04:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D244F28A6A; Sun, 14 Apr 2019 04:56:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E824628A57 for ; Sun, 14 Apr 2019 04:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=AETwaF5NQF360dRTVhkCOMvv//84MeqRD4nQgMqC6Fc=; b=jTV SMt4uoldEnGHSl6K3xzGbYIZ9aIz1734wMX/OvmvzUsax1+2ngBi+c3PlSv77UnW+oYXfekkWi2pa 6g/3/hMj+RdGfVLsCqiwpDesDfNiN6lndHn3nq19HGTT7QkzmtGUb3MVb1TXBaHPfDxOhgYWXPQ/I khCkWdLjJvnQREb9P0jB4NTABfjiMUqn7mLXl+Vqz53t/qBpttTwjaNDi0hrLkXQCDeO0Jl8dfBC0 TLn3w1eymfHjQlBWiYOU43JlCPpw9HeU7qe7bac4NGKVpqTV7qoP5IL18ltJ6CoLwFy875sZvo7AM DiQ5K37791f9mK+ZV163GieZ2MJQtoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFXCE-0007by-Cy; Sun, 14 Apr 2019 04:56:50 +0000 Received: from www.osadl.org ([2001:a60:9266:ffff:62:245:132:105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFXCA-0007b7-KV for linux-arm-kernel@lists.infradead.org; Sun, 14 Apr 2019 04:56:48 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3E4tDwi021036; Sun, 14 Apr 2019 06:55:14 +0200 From: Nicholas Mc Guire To: Jason Cooper Subject: [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Date: Sun, 14 Apr 2019 06:49:49 +0200 Message-Id: <1555217391-3552-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190413_215646_972374_A31A1F43 X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Gregory Clement , linux-kernel@vger.kernel.org, Russell King , Nicholas Mc Guire , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Although it is very unlikely that the allocation during init would fail any such failure should point to the original cause rather than waiting for a null-pointer dereference to splat. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script While this will not really help much - but kzalloc failures should not go unhandled. Patch was compile-tested: mvebu_v7_defconfig (implies MACH_MVEBU_ANY=y) (with some unrelated sparse warnings about missing syscalls) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-mvebu/board-v7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 0b10acd..37f8cb6 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -128,6 +128,7 @@ static void __init i2c_quirk(void) struct property *new_compat; new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL); + WARN_ON(!new_compat); new_compat->name = kstrdup("compatible", GFP_KERNEL); new_compat->length = sizeof("marvell,mv78230-a0-i2c");