All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure
@ 2019-04-14  4:49 ` Nicholas Mc Guire
  0 siblings, 0 replies; 16+ messages in thread
From: Nicholas Mc Guire @ 2019-04-14  4:49 UTC (permalink / raw)
  To: Jason Cooper
  Cc: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Russell King, linux-arm-kernel, linux-kernel, Nicholas Mc Guire

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. 

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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-04-21 17:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-04-14 23:24     ` Nicholas Mc Guire

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.