[Skiboot] [PATCH 3/3] hdata: Prevent NULL dereference on duplicate slot map info

Stewart Smith stewart at linux.ibm.com
Mon Mar 18 16:52:19 AEDT 2019


Signed-off-by: Stewart Smith <stewart at linux.ibm.com>
---
 hdata/iohub.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hdata/iohub.c b/hdata/iohub.c
index ad1ddae401f0..028fc6abdc0f 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -660,6 +660,10 @@ static void parse_one_slot(const struct slot_map_entry *entry,
 	case st_rc_slot:
 		node = dt_new_2addr(dt_slots, "root-complex",
 						chip_id, entry->phb_index);
+		if (!node) {
+			SM_ERR("Couldn't add DT node\n");
+			return;
+		}
 		dt_add_property_cells(node, "reg", chip_id, entry->phb_index);
 		dt_add_property_cells(node, "#address-cells", 2);
 		dt_add_property_cells(node, "#size-cells", 0);
-- 
2.20.1



More information about the Skiboot mailing list