Skip to contentSkip to conversation

ARM/mvebu: Fix possible null dereference in armada_375_380_coherency_init

PATCH New yuuoniy 1 participant 1 message Nov 15, 2021

Subsystems (3)
lore
Share & tools
lore

yuuoniy

author
#0 lore raw

PATCH 1/1 ARM/mvebu: Fix possible null dereference in armada_375_380_coherency_init

Prevent potential when access p->name after unsuccessful allocation.

---
 arch/arm/mach-mvebu/coherency.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-mvebu/coherency.c +2 -0
index 49e3c8d20c2f..4fdb1fae63c5 100644
@@ -194,6 +194,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);
 	}
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel