aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-08-03 16:45:48 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-15 16:37:14 +1000
commit01cf91bad95e0970752cf7090e264ea9103437b4 (patch)
tree3868c6764f18c56ed0e7553f3d6e1d574a2184f9 /hdata
parent0241b32d0d02da6b08b329c5ccbafdca8e9a738a (diff)
downloadskiboot-01cf91bad95e0970752cf7090e264ea9103437b4.zip
skiboot-01cf91bad95e0970752cf7090e264ea9103437b4.tar.gz
skiboot-01cf91bad95e0970752cf7090e264ea9103437b4.tar.bz2
hdata/vpd: Fix possible NULL dereference (CID 144258)
Only use devicetree model if there was one. Fixes: CID 144258 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/vpd.c4
1 files changed, 1 insertions, 3 deletions
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;