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

* Re: [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer
  2010-05-27 12:37 [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer dereference Julia Lawall
@ 2010-05-27 13:15 ` Johan Hovold
  2010-06-03 17:45   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2010-05-27 13:15 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, kernel-janitors

Hi Julia, 

On Thu, May 27, 2010 at 02:37:39PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> The assignment seems completely unnecessary if mos7840_port is NULL.
> 
[...]
> ---
>  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;
>  	}

I stumbled over this one a couple of weeks ago. There a patch sitting in
Greg's queue already:

	http://thread.gmane.org/gmane.linux.usb.general/31668

Thanks,
Johan

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

* Re: [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer
  2010-05-27 13:15 ` [PATCH 11/11] drivers/usb/serial: Eliminate a NULL pointer Johan Hovold
@ 2010-06-03 17:45   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2010-06-03 17:45 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Julia Lawall, Greg Kroah-Hartman, linux-usb, linux-kernel,
	kernel-janitors

On Thu, May 27, 2010 at 03:15:39PM +0200, Johan Hovold wrote:
> Hi Julia, 
> 
> On Thu, May 27, 2010 at 02:37:39PM +0200, Julia Lawall wrote:
> > From: Julia Lawall <julia@diku.dk>
> > 
> > The assignment seems completely unnecessary if mos7840_port is NULL.
> > 
> [...]
> > ---
> >  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;
> >  	}
> 
> I stumbled over this one a couple of weeks ago. There a patch sitting in
> Greg's queue already:
> 
> 	http://thread.gmane.org/gmane.linux.usb.general/31668

Which is now in my tree.

thanks,

greg k-h

^ permalink raw reply	[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).