Message ID | 20181017144533.12571-2-npiggin@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] core/flash: NULL pointer dereference fixes | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
snowpatch_ozlabs/make_check | success | Test make_check on branch master |
diff --git a/core/device.c b/core/device.c index 19a8d8d6..6364a60e 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,
This was caught with unmapped memory dereference page faults. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- core/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)