From 01cf91bad95e0970752cf7090e264ea9103437b4 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Thu, 3 Aug 2017 16:45:48 +1000 Subject: hdata/vpd: Fix possible NULL dereference (CID 144258) Only use devicetree model if there was one. Fixes: CID 144258 Signed-off-by: Cyril Bur Reviewed-by: Vasant Hegde Signed-off-by: Stewart Smith --- hdata/vpd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'hdata/vpd.c') diff --git a/hdata/vpd.c b/hdata/vpd.c index 9a0e0da..d7d57cd 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; -- cgit v1.1