summaryrefslogtreecommitdiffstats
path: root/bsps
diff options
context:
space:
mode:
authorG S Niteesh Babu <niteesh.gs@gmail.com>2021-02-06 23:10:09 +0530
committerChristian Mauderer <oss@c-mauderer.de>2021-02-08 21:08:36 +0100
commitc4985b7718a9bba270aa8a9d39276d54d9a39101 (patch)
tree418d2b934cf80834102937dc3ae61742e902cf77 /bsps
parentvalidation: Tweak construct error tests (diff)
downloadrtems-c4985b7718a9bba270aa8a9d39276d54d9a39101.tar.bz2
bsps/shared/ofw: Fix coverity reported defects
Fixed use after free and null pointer dereference defects FIXES: 1) CID 1472601 (NULL_RETURNS) 2) CID 1472600 (USE_AFTER_FREE) 3) CID 1472599 (USE_AFTER_FREE) 4) CID 1472598 (USE_AFTER_FREE) 5) CID 1472596 (USE_AFTER_FREE) The below two defects have to marked false positive 1) CID 1472597 (ARRAY_VS_SINGLETON) 2) CID 1472595 (ARRAY_VS_SINGLETON)
Diffstat (limited to 'bsps')
-rw-r--r--bsps/shared/ofw/ofw.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bsps/shared/ofw/ofw.c b/bsps/shared/ofw/ofw.c
index 82924b2600..fa94bfbf05 100644
--- a/bsps/shared/ofw/ofw.c
+++ b/bsps/shared/ofw/ofw.c
@@ -313,7 +313,7 @@ ssize_t rtems_ofw_get_prop_alloc(
}
if (rtems_ofw_get_prop(node, propname, *buf, len) == -1) {
- rtems_ofw_free(buf);
+ rtems_ofw_free(*buf);
*buf = NULL;
return -1;
}
@@ -344,7 +344,7 @@ ssize_t rtems_ofw_get_prop_alloc_multi(
}
if (rtems_ofw_get_prop(node, propname, *buf, len) == -1) {
- rtems_ofw_free(buf);
+ rtems_ofw_free(*buf);
*buf = NULL;
return -1;
}
@@ -373,7 +373,7 @@ ssize_t rtems_ofw_get_enc_prop_alloc(
}
if (rtems_ofw_get_enc_prop(node, propname, *buf, len) == -1) {
- rtems_ofw_free(buf);
+ rtems_ofw_free(*buf);
*buf = NULL;
return -1;
}
@@ -404,7 +404,7 @@ ssize_t rtems_ofw_get_enc_prop_alloc_multi(
}
if (rtems_ofw_get_enc_prop(node, propname, *buf, len) == -1) {
- rtems_ofw_free(buf);
+ rtems_ofw_free(*buf);
*buf = NULL;
return -1;
}
@@ -614,7 +614,7 @@ int rtems_ofw_get_reg(
offset = rtems_fdt_phandle_to_offset(parent);
ptr = fdt_getprop(fdtp, offset, "ranges", &len);
- if (len < 0) {
+ if (ptr == NULL) {
break;
}