[PATCH] arm: mvebu: fix null pointer when access

Li Jun lijun01 at kylinos.cn
Wed Mar 18 00:53:24 PDT 2026


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

Signed-off-by: Li Jun <lijun01 at 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




More information about the linux-arm-kernel mailing list