public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: mvebu: fix null pointer when access
@ 2026-03-18  7:53 Li Jun
  2026-03-18  8:03 ` Russell King (Oracle)
  2026-03-18 13:29 ` Andrew Lunn
  0 siblings, 2 replies; 3+ messages in thread
From: Li Jun @ 2026-03-18  7:53 UTC (permalink / raw)
  To: andrew, gregory.clement, sebastian.hesselbarth, linux,
	linux-arm-kernel, linux-kernel, lijun01

the kzalloc may return null pointer, will cause kernel panic.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
---
 arch/arm/mach-mvebu/coherency.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index a6b621ff0b87..beba8ed9fa15 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -191,6 +191,8 @@ static void __init armada_375_380_coherency_init(struct device_node *np)
 		struct property *p;
 
 		p = kzalloc(sizeof(*p), GFP_KERNEL);
+		if (!p)
+			return;
 		p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
 		of_add_property(cache_dn, p);
 	}
-- 
2.25.1


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

* Re: [PATCH] arm: mvebu: fix null pointer when access
  2026-03-18  7:53 [PATCH] arm: mvebu: fix null pointer when access Li Jun
@ 2026-03-18  8:03 ` Russell King (Oracle)
  2026-03-18 13:29 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2026-03-18  8:03 UTC (permalink / raw)
  To: Li Jun
  Cc: andrew, gregory.clement, sebastian.hesselbarth, linux-arm-kernel,
	linux-kernel

On Wed, Mar 18, 2026 at 03:53:24PM +0800, Li Jun wrote:
> the kzalloc may return null pointer, will cause kernel panic.

So might kstrdup(), but you haven't fixed this one either.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH] arm: mvebu: fix null pointer when access
  2026-03-18  7:53 [PATCH] arm: mvebu: fix null pointer when access Li Jun
  2026-03-18  8:03 ` Russell King (Oracle)
@ 2026-03-18 13:29 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-03-18 13:29 UTC (permalink / raw)
  To: Li Jun
  Cc: gregory.clement, sebastian.hesselbarth, linux, linux-arm-kernel,
	linux-kernel

On Wed, Mar 18, 2026 at 03:53:24PM +0800, Li Jun wrote:
> the kzalloc may return null pointer, will cause kernel panic.

The kernel is a dead man walking if the memory allocation fails, so
that coherency cannot be configured correctly. A panic at least gives
a stack trace, rather than a nearly undebuggable deadlock later on.

Not all kernel panics are bad. You need to look at the context, the
comments in the code.

	 Andrew

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

end of thread, other threads:[~2026-03-18 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  7:53 [PATCH] arm: mvebu: fix null pointer when access Li Jun
2026-03-18  8:03 ` Russell King (Oracle)
2026-03-18 13:29 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox