[Skiboot] [PATCH 3/8] gard: Fix up path parsing

Oliver O'Halloran oohall at gmail.com
Thu Nov 30 16:31:24 AEDT 2017


Currently we assume that the Unit ID can be used as an array index into
the chip_units[] structure. There are holes in the ID space though, so
this doesn't actually work. Fix it up by walking the array looking for
the ID.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 external/gard/gard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/external/gard/gard.c b/external/gard/gard.c
index c70fa2a3ccfd..5a57415ab5a7 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -325,7 +325,7 @@ int parse_path(const char *str, struct entity_path *parsed)
 		parsed->path_elements[unit_count].target_type = unit_id;
 
 		/* now parse the instance # */
-		len = strlen(chip_units[unit_id].desc);
+		len = strlen(target_type_to_str(unit_id));
 		instance = strtol(str + len, &end, 10);
 
 		if (!isdigit(*(str + len))) {
-- 
2.9.5



More information about the Skiboot mailing list