Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1455068yba; Sun, 14 Apr 2019 10:28:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwObO8zlEF/CtkW+zMiDgdmftxY50GyPYT+hyKtVMglNbl/MOqsL/KsAcYIyi9Qlxg/WWu3 X-Received: by 2002:a62:61c2:: with SMTP id v185mr70841033pfb.117.1555262923133; Sun, 14 Apr 2019 10:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555262923; cv=none; d=google.com; s=arc-20160816; b=0PaOaSL084AZJIbQX0Pzht52LeS6sl9F/J31S4D0tMjZziXfImHce2xzYH1ZS9fV1Q H3yKzpKma0e6NVUap6SmisRefe/8WpOZlPJOhr3J6aUNHH0A0fk5im2T3toRMSCWB7+G SiSs1g18/WJYe1ZmDPrrkKJWc75sodGnrG1DdQMXkTeK2s9B+ORNWO3GQQNkL0fX4PXG G2egneecQUohr7MzZuk/EMT7IBXwcBcKGjS0F+hPqpwsgF0EJP7m/frBqhjjYkkzEHGF SKZKJm4UmR8TB35mo1pviQEbHH8DA9WZN3f4iFCqfZxoAbUnhqYh+tB0JEHcO1tnV2uY jjoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BoixTUrM58QhLIGqkkXnVCGjoXLsor6OntDo/Wl+gm4=; b=gJUmEFHDFJ9apBieqsOraYNmxo+WoghGIemyJbYM+NqI6QHGgY10ImjMy4KzPGpNX+ y9kY2zM5HByMgxdCq+hybbmRrWClW2Y+VTl10Wx8hspd0bcRVC8QNY0s7ixd8RH3xgLl 675PEBgGKwme/CXYCHbvM8RNiC2Jg5jO9LlDr5bbiErElMxppqNZLBgBTWC3u2Ygc2YU hXvTwmEPUuhJdWIkqjCMGkRy40YQyBC4VprRuCxIRnbWN0MMRQ9Nzpl4q/UHxg0cFAEF VbQMBalGsXo67SJwPggpCTI1E4UgjtvextDXL78xq9VDxdO7CTCWiHc1zRGt6tZxZCRu gFuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=vNe42JRt; 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=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si31177632pgp.557.2019.04.14.10.28.26; Sun, 14 Apr 2019 10:28:43 -0700 (PDT) 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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=vNe42JRt; 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=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbfDNR0W (ORCPT + 99 others); Sun, 14 Apr 2019 13:26:22 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:33454 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbfDNR0V (ORCPT ); Sun, 14 Apr 2019 13:26:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BoixTUrM58QhLIGqkkXnVCGjoXLsor6OntDo/Wl+gm4=; b=vNe42JRtLO1YFBSYGHK0ebk+x oy5n/gvVrKwK9TT0tcgtVdHLwCfvODQJvqz6WP/wgsCVRGK3poUeFHFttTKBg7u9tspUWu62XF8YL 5GJ7gooUeOafR8mjHB90KN+stzl8rEgD+LQC25qgt+RuVunR9FMbgY56RajfNezBuYrH1sjMKwOW6 jd+Rt/OOdQKDUFOAe2afHHd12/8ukYUD54VBLRhznyvC5pgHpcHXPpJ4S5/e1Sq8L1hr1qaTT24SY CYn9Xv/4kjVkuJIwuScklgBRTgZpLJjVIClQCd4JOQ5CosIc1ui8hh/LGzTCmLb57pZEGo5W6AU8e S9sxwy4+w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:52108) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hFitO-00005m-W6; Sun, 14 Apr 2019 18:26:11 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1hFitH-0006nT-1g; Sun, 14 Apr 2019 18:26:03 +0100 Date: Sun, 14 Apr 2019 18:26:02 +0100 From: Russell King - ARM Linux admin To: Nicholas Mc Guire Cc: Jason Cooper , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Message-ID: <20190414172602.z6d4swzk6bjjumls@shell.armlinux.org.uk> References: <1555217391-3552-1-git-send-email-hofrat@osadl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1555217391-3552-1-git-send-email-hofrat@osadl.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 14, 2019 at 06:49:49AM +0200, Nicholas Mc Guire wrote: > 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. Sorry, no, not like this. With this patch, rather than getting an oops and a stacktrace which people can capture and email, we instead end up getting a warning line, a stack trace, followed by an oops containing another stack trace. We _already_ have problems getting people to send us kernel message debug information without editing out what they deem to be "unnecessary verbage", like all those numbers and function names that comprise a stack trace. We don't need yet more of that stuff, especially when it is redundant. So, I think throwing WARN_ON() at this case is way too excessive, and will only have a detrimental effect on the reports we receive - and that is extremely important. IMHO, A better solution would be to just print a warning, rather than causing the kernel to print several kB of needless messages. if (!new_compat) pr_err("new_compat allocation failure in %s()\n", __func__); > > 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"); > -- > 2.1.4 > > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up