[Skiboot] [PATCH 09/12] hdata/vpd: Fix possible NULL dereference (CID 144258)
Cyril Bur
cyril.bur at au1.ibm.com
Thu Aug 3 16:45:48 AEST 2017
Only use devicetree model if there was one.
Fixes: CID 144258
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
hdata/vpd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 9a0e0da9..d7d57cda 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -510,8 +510,6 @@ static void dt_add_model_name(void)
const struct dt_property *model;
model = dt_find_property(dt_root, "model");
- if (!model)
- goto def_model;
iplp = get_hdif(&spira.ntuples.ipl_parms, "IPLPMS");
if (!iplp)
@@ -525,7 +523,7 @@ static void dt_add_model_name(void)
model_name = p->sys_type_str;
def_model:
- if (!model_name || model_name[0] == '\0') {
+ if ((!model_name || model_name[0] == '\0') && model) {
mi = machine_info_lookup(model->prop);
if (mi)
model_name = mi->name;
--
2.13.3
More information about the Skiboot
mailing list