diff options
author | Ananth N Mavinakayanahalli <ananth@in.ibm.com> | 2015-06-17 13:53:52 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-06-19 07:37:36 +1000 |
commit | c6d008d94be3831071621d29f9b5c4570897a272 (patch) | |
tree | c18fdaa2319d83f498675f7eab0cf4e03b935fe2 /core/device.c | |
parent | 58ffd37475ede29575479854da94dd12782168e3 (diff) | |
download | skiboot-c6d008d94be3831071621d29f9b5c4570897a272.zip skiboot-c6d008d94be3831071621d29f9b5c4570897a272.tar.gz skiboot-c6d008d94be3831071621d29f9b5c4570897a272.tar.bz2 |
Verify zalloc returned valid pointer
Else, we are dereferencing NULL
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/device.c')
-rw-r--r-- | core/device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/device.c b/core/device.c index 09f76d7..ba427de 100644 --- a/core/device.c +++ b/core/device.c @@ -348,6 +348,9 @@ struct dt_property *dt_add_property_nstr(struct dt_node *node, struct dt_property *p; char *tmp = zalloc(vlen + 1); + if (!tmp) + return NULL; + strncpy(tmp, value, vlen); p = dt_add_property(node, name, tmp, strlen(tmp)+1); free(tmp); |