Hello. On 07/24/2012 11:17 PM, Mark Ferrell wrote: > * mos7840_startup() blindly calls kfree() on memory that may have never been > allocated. Calling kfree() on a NULL pointers is perfectly valid. > Signed-off-by: Mark Ferrell <mferrell@xxxxxxxxxxx> > --- > drivers/usb/serial/mos7840.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c > index 57eca24..1afb141 100644 > --- a/drivers/usb/serial/mos7840.c > +++ b/drivers/usb/serial/mos7840.c > @@ -2678,10 +2678,15 @@ error: > for (/* nothing */; i >= 0; i--) { > mos7840_port = mos7840_get_port_private(serial->port[i]); > > - kfree(mos7840_port->dr); > - kfree(mos7840_port->ctrl_buf); > - usb_free_urb(mos7840_port->control_urb); > - kfree(mos7840_port); > + if (mos7840_port) { > + if (mos7840_port->control_urb) > + usb_free_urb(mos7840_port->control_urb); > + if (mos7840_port->ctrl_buf) > + kfree(mos7840_port->ctrl_buf); > + if (mos7840_port->dr) > + kfree(mos7840_port->dr); > + kfree(mos7840_port); > + } > serial->port[i] = NULL; > } > return status; WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html