summaryrefslogtreecommitdiffstats
path: root/hdata/vpd.c
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-07-04 11:33:26 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-04 11:33:26 +1000
commit7caeac887536188fb97a052024ef7006496388fb (patch)
tree8165161418248416d69377bc3532fd9f3b65368a /hdata/vpd.c
parent8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8 (diff)
downloadblackbird-skiboot-7caeac887536188fb97a052024ef7006496388fb.tar.gz
blackbird-skiboot-7caeac887536188fb97a052024ef7006496388fb.zip
hdata/vpd: Don't dereference possible NULL model_name
It's legitimate to just add model-name to the device tree if we have one, which is what the hdata logic tries to do, but subtley fails in one of the code paths. Found by static analysis Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/vpd.c')
-rw-r--r--hdata/vpd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hdata/vpd.c b/hdata/vpd.c
index a2c8906c..9a0e0da9 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2014 IBM Corp.
+/* Copyright 2013-2017 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -527,12 +527,12 @@ static void dt_add_model_name(void)
def_model:
if (!model_name || model_name[0] == '\0') {
mi = machine_info_lookup(model->prop);
- if (mi) {
+ if (mi)
model_name = mi->name;
- }
}
- dt_add_property_string(dt_root, "model-name", model_name);
+ if(model_name)
+ dt_add_property_string(dt_root, "model-name", model_name);
}
static void sysvpd_parse_opp(const void *sysvpd, unsigned int sysvpd_sz)
OpenPOWER on IntegriCloud