aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-10-18 00:45:33 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-10-23 20:08:21 -0500
commitc4230046ecd5b334b1a3a9d8145f8264b1d4f981 (patch)
tree7ee95d4c70f4f95837e59a0b03b461bae6284cca
parent12b74c455bede6a402fb7f44aca5df9186652e74 (diff)
downloadskiboot-c4230046ecd5b334b1a3a9d8145f8264b1d4f981.zip
skiboot-c4230046ecd5b334b1a3a9d8145f8264b1d4f981.tar.gz
skiboot-c4230046ecd5b334b1a3a9d8145f8264b1d4f981.tar.bz2
core/device: NULL pointer dereference fix
This was caught with unmapped memory dereference page faults. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--core/device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/device.c b/core/device.c
index 19a8d8d..6364a60 100644
--- a/core/device.c
+++ b/core/device.c
@@ -494,7 +494,10 @@ struct dt_property *dt_add_property_string(struct dt_node *node,
const char *name,
const char *value)
{
- return dt_add_property(node, name, value, strlen(value)+1);
+ size_t len = 0;
+ if (value)
+ len = strlen(value) + 1;
+ return dt_add_property(node, name, value, len);
}
struct dt_property *dt_add_property_nstr(struct dt_node *node,