[Skiboot] [PATCH 4/8] cpu_remove_node() : Fix potential null dereference

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Tue Jun 23 18:37:34 AEST 2015


Fix potential NULL dereference of pointer returned
from  dt_find_property() in cpu_remove_node().

Fixes coverity defect#97849.

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
---
 core/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/cpu.c b/core/cpu.c
index a9a00dc..b646f69 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -340,6 +340,8 @@ void cpu_remove_node(const struct cpu_thread *t)
 		if (!dt_has_node_property(i, "device_type", "cpu"))
 			continue;
 		p = dt_find_property(i, "ibm,pir");
+		if (!p)
+			continue;
 		if (dt_property_get_cell(p, 0) == t->pir) {
 			dt_free(i);
 			return;
-- 
2.1.2



More information about the Skiboot mailing list