kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer dereference
@ 2010-05-27 12:37 Julia Lawall
  2010-05-27 13:15 ` [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2010-05-27 12:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

The assignment seems completely unnecessary if mos7840_port is NULL.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E = NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/usb/serial/mos7840.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index f8424d1..585b7e6 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -730,7 +730,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
 	mos7840_port = urb->context;
 	if (!mos7840_port) {
 		dbg("%s", "NULL mos7840_port pointer");
-		mos7840_port->read_urb_busy = false;
 		return;
 	}
 

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

end of thread, other threads:[~2010-06-03 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 12:37 [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer dereference Julia Lawall
2010-05-27 13:15 ` [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer Johan Hovold
2010-06-03 17:45   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).