diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2018-10-18 00:45:33 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-10-23 20:08:21 -0500 |
commit | c4230046ecd5b334b1a3a9d8145f8264b1d4f981 (patch) | |
tree | 7ee95d4c70f4f95837e59a0b03b461bae6284cca | |
parent | 12b74c455bede6a402fb7f44aca5df9186652e74 (diff) | |
download | skiboot-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.c | 5 |
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, |