From: Nicholas Mc Guire <der.herr@hofr.at> To: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Nicholas Mc Guire <hofrat@osadl.org>, Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>, Gregory Clement <gregory.clement@bootlin.com>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>, 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 Date: Mon, 15 Apr 2019 01:24:43 +0200 [thread overview] Message-ID: <20190414232443.GB1215@osadl.at> (raw) In-Reply-To: <20190414172602.z6d4swzk6bjjumls@shell.armlinux.org.uk> 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 <hofrat@osadl.org> > > --- > > > > 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
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <der.herr@hofr.at> To: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>, Gregory Clement <gregory.clement@bootlin.com>, linux-kernel@vger.kernel.org, Nicholas Mc Guire <hofrat@osadl.org>, linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Subject: Re: [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Date: Mon, 15 Apr 2019 01:24:43 +0200 [thread overview] Message-ID: <20190414232443.GB1215@osadl.at> (raw) In-Reply-To: <20190414172602.z6d4swzk6bjjumls@shell.armlinux.org.uk> 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 <hofrat@osadl.org> > > --- > > > > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-14 23:25 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-14 4:49 [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Nicholas Mc Guire 2019-04-14 4:49 ` Nicholas Mc Guire 2019-04-14 4:49 ` [PATCH 2/3] ARM: mvebu: drop return from void function Nicholas Mc Guire 2019-04-14 4:49 ` Nicholas Mc Guire 2019-04-21 17:23 ` Gregory CLEMENT 2019-04-21 17:23 ` Gregory CLEMENT 2019-04-14 4:49 ` [PATCH 3/3] ARM: mvebu: add SPDX license identifier Nicholas Mc Guire 2019-04-14 4:49 ` Nicholas Mc Guire 2019-04-14 16:22 ` Andrew Lunn 2019-04-14 16:22 ` Andrew Lunn 2019-04-14 23:22 ` Nicholas Mc Guire 2019-04-14 23:22 ` Nicholas Mc Guire 2019-04-14 17:26 ` [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure Russell King - ARM Linux admin 2019-04-14 17:26 ` Russell King - ARM Linux admin 2019-04-14 23:24 ` Nicholas Mc Guire [this message] 2019-04-14 23:24 ` Nicholas Mc Guire
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190414232443.GB1215@osadl.at \ --to=der.herr@hofr.at \ --cc=andrew@lunn.ch \ --cc=gregory.clement@bootlin.com \ --cc=hofrat@osadl.org \ --cc=jason@lakedaemon.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=sebastian.hesselbarth@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.