[Skiboot] [PATCH 2/2] core/device: NULL pointer dereference fix
Nicholas Piggin
npiggin at gmail.com
Thu Oct 18 01:45:33 AEDT 2018
This was caught with unmapped memory dereference page faults.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/device.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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,
--
2.18.0
More information about the Skiboot
mailing list