Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1644075yba; Sun, 14 Apr 2019 16:26:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5zswKGo4ZzvZKkuX8JLB5xHCM4TEEFxAlqsS0IBnER8P2kCsHcuoqE7P2H1lLyEXAc7N3 X-Received: by 2002:a63:e915:: with SMTP id i21mr66513599pgh.297.1555284415473; Sun, 14 Apr 2019 16:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555284415; cv=none; d=google.com; s=arc-20160816; b=bwn21JI8f4O+tOTapHHMMaQBnZKa4uKS4zjRLUL6IisRIdAvTiClIYS/Z33/OT7Cgi XIv8qBS3w1ZxxaiyYtbdbUJHJS70tB0U5jaTJqo6kwHZnK1CXRGIHvWZ/AH0H9bV4IBQ Ttu6sJj3TjEMGpAkog7uCJRbORELOgImq3Vt1vrwpoEx+eRJikHC7G7uvMbbjgyeYjIj VaEpYCY9dOsTX/tvj/qiHQA6xyElk1+H3+svG5w6AXYR8mG9W8v36btMVKcBBwNv3PRW XS5o5l+YaEBWXfLgc2flXma1brhRRBG87eODRZCveqtvvCJQUBzDJe+5cySzMx+B5mr3 S3ew== 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; bh=lx9Fc2RbAGC/XfZA7v/0JeNc7Hc8SREsOB7Cld50vIs=; b=1GYeJyGU69cM7VLRmwdxcjd243r29AalbecCvZN4FnBe/rtGFpFKWVQFFkzsu8B3oK yIM08Af3vqGYU3LZ1iCNn1WLQt4cyhHvqQYyJGAryA/yH8+4zgJkXTf+v0hl85CvvnZX qYHiXhX2BfbkEuoZIp1SAnngIG2rsMBh1x8oZbauljwb4YZDXFTfU9I3EAxfRC+3jYx5 DujuzMSwIQFu2nDY/cCywB/Q2S25ILA6ZnnUqkEvCOZrSGppjqes99qr93nWaJApxGPz +OmcJtQyK1cQExqDuhyhxR/gdIQBsR3VSm75xDTFNlsX4tai5vcATeuaq+MRHedWAHQ6 Vztg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e36si43005773pgm.89.2019.04.14.16.26.39; Sun, 14 Apr 2019 16:26:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726464AbfDNXZc (ORCPT + 99 others); Sun, 14 Apr 2019 19:25:32 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:42455 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfDNXZb (ORCPT ); Sun, 14 Apr 2019 19:25:31 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id 67F6A5C1578; Mon, 15 Apr 2019 01:24:43 +0200 (CEST) Date: Mon, 15 Apr 2019 01:24:43 +0200 From: Nicholas Mc Guire To: Russell King - ARM Linux admin Cc: Nicholas Mc Guire , 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: <20190414232443.GB1215@osadl.at> References: <1555217391-3552-1-git-send-email-hofrat@osadl.org> <20190414172602.z6d4swzk6bjjumls@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190414172602.z6d4swzk6bjjumls@shell.armlinux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) 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:26:02PM +0100, Russell King - ARM Linux admin wrote: > 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. > ok - well I wsa not sure about it either - it just seems wrong to leave a possible allocation failure without any response. The issue of generating excessive outout make sense - so will fix it up to a pr_err() and resend. thx! hofrat > 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