summaryrefslogtreecommitdiff
path: root/drivers/remoteproc/rproc-uclass.c
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2015-11-30 22:05:58 -0600
committerTom Rini <trini@konsulko.com>2015-12-05 18:22:32 -0500
commit9cb05a8f9f87297820a5ff6a487f100cb1cd69c1 (patch)
tree7523ae532bd635f2d666fa030a381824db75d6bd /drivers/remoteproc/rproc-uclass.c
parent5be93569262f4ebc963ca95891667f523f368d89 (diff)
downloadu-boot-imx-9cb05a8f9f87297820a5ff6a487f100cb1cd69c1.zip
u-boot-imx-9cb05a8f9f87297820a5ff6a487f100cb1cd69c1.tar.gz
u-boot-imx-9cb05a8f9f87297820a5ff6a487f100cb1cd69c1.tar.bz2
drivers: remoteproc: rproc-uclass: Fix check for NULL pointers
Neither uc_pdata->name nor check_name are supposed to be NULL in _rproc_name_is_unique(). if uc_pdata->name is NULL, we are not intialized yet, however if check_data is NULL, we do not have proper data. Further, if either were NULL, strlen will crap out while attempting to derefence NULL. Instead, just check if either of these are NULL and bail out. This should also fix the following coverity scan warnings: *** CID 132281: Null pointer dereferences (FORWARD_NULL) /drivers/remoteproc/rproc-uclass.c: 73 in _rproc_name_is_unique() Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Nishanth Menon <nm@ti.com>
Diffstat (limited to 'drivers/remoteproc/rproc-uclass.c')
-rw-r--r--drivers/remoteproc/rproc-uclass.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index a421e12..200cf61 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -66,7 +66,7 @@ static int _rproc_name_is_unique(struct udevice *dev,
const char *check_name = data;
/* devices not yet populated with data - so skip them */
- if (!uc_pdata->name && check_name)
+ if (!uc_pdata->name || !check_name)
return 0;
/* Return 0 to search further if we dont match */