Re: [PATCH] Fix for possible null pointer dereference in node.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay, everyone agrees with Dan..?

I have made a new patch, which does not check if hnode is NULL.



Best regards
Rickard Strandqvist


2014-05-16 0:43 GMT+02:00 Dan Carpenter <dan.carpenter@xxxxxxxxxx>:
> On Thu, May 15, 2014 at 11:53:53PM +0200, Rickard Strandqvist wrote:
>> There is otherwise a risk of a possible null pointer dereference.
>>
>
> None of the callers pass in a NULL hnode so there isn't actually a NULL
> dereference here.  You could just remove the check.
>
> regards,
> dan carpenter
>
From 5986593f49044f1c4faef09b1e4db3ed8ec557d3 Mon Sep 17 00:00:00 2001
From: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Date: Sun, 11 May 2014 18:51:42 +0200
Subject: [PATCH] staging: tidspridge: node.c: fix for possible null pointer dereference

Removde unnecessary check for null pointer.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
 drivers/staging/tidspbridge/rmgr/node.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 9d3044a..d918f7f 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -2365,8 +2365,6 @@ static void delete_node(struct node_object *hnode,
 	    (struct proc_object *)hnode->processor;
 #endif
 	int status;
-	if (!hnode)
-		goto func_end;
 	hnode_mgr = hnode->node_mgr;
 	if (!hnode_mgr)
 		goto func_end;
-- 
1.7.10.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux