public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8712: usb_intf.c:  Fix for possible null pointer dereference
@ 2014-05-20 21:34 Rickard Strandqvist
  2014-05-20 22:03 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-05-20 21:34 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel
  Cc: Rickard Strandqvist, Greg Kroah-Hartman, Andy Shevchenko, devel,
	linux-kernel

There is otherwise a risk of a possible null pointer dereference.

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

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/rtl8712/usb_intf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index bbd5888..ba74354 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -595,7 +595,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 error:
 	usb_put_dev(udev);
 	usb_set_intfdata(pusb_intf, NULL);
-	if (padapter->dvobj_deinit != NULL)
+	if (padapter && padapter->dvobj_deinit != NULL)
 		padapter->dvobj_deinit(padapter);
 	if (pnetdev)
 		free_netdev(pnetdev);
-- 
1.7.10.4


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

* Re: [PATCH] staging: rtl8712: usb_intf.c: Fix for possible null pointer dereference
  2014-05-20 21:34 [PATCH] staging: rtl8712: usb_intf.c: Fix for possible null pointer dereference Rickard Strandqvist
@ 2014-05-20 22:03 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-05-20 22:03 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Larry Finger, Florian Schilhabel, devel, Greg Kroah-Hartman,
	Andy Shevchenko, linux-kernel

On Tue, May 20, 2014 at 11:34:25PM +0200, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
> 
> Was largely found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

This is a real bug.  :)

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

Btw, I have named this kind of bug a "one err bug" because there is one
"err:" label which handles all the error handling.  It is a very common
kind of bug.

regards,
dan carpenter


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

end of thread, other threads:[~2014-05-20 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 21:34 [PATCH] staging: rtl8712: usb_intf.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-20 22:03 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox