All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers: remoteproc: rproc-uclass: Fix check for NULL pointers
@ 2015-12-01  4:05 Nishanth Menon
  2015-12-06 22:07 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Nishanth Menon @ 2015-12-01  4:05 UTC (permalink / raw)
  To: u-boot

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>
---
Test log: http://pastebin.ubuntu.com/13591420/

 drivers/remoteproc/rproc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index a421e12e5d16..200cf61bc948 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 */
-- 
2.6.2.402.g2635c2b

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] drivers: remoteproc: rproc-uclass: Fix check for NULL pointers
  2015-12-01  4:05 [U-Boot] [PATCH] drivers: remoteproc: rproc-uclass: Fix check for NULL pointers Nishanth Menon
@ 2015-12-06 22:07 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2015-12-06 22:07 UTC (permalink / raw)
  To: u-boot

On Mon, Nov 30, 2015 at 10:05:58PM -0600, Nishanth Menon wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151206/76332585/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-06 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01  4:05 [U-Boot] [PATCH] drivers: remoteproc: rproc-uclass: Fix check for NULL pointers Nishanth Menon
2015-12-06 22:07 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.