lkml.org 
[lkml]   [2006]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/usb/serial/aircable.c: inconsequent NULL checking
The Coverity checker spotted the following in 
drivers/usb/serial/aircable.c:

<-- snip -->

...
static void aircable_read(void *params)
{
struct usb_serial_port *port = params;
struct aircable_private *priv = usb_get_serial_port_data(port);
struct tty_struct *tty;
unsigned char *data;
int count;
if (priv->rx_flags & THROTTLED){
if (priv->rx_flags & ACTUALLY_THROTTLED)
schedule_work(&priv->rx_work);
return;
}

/* By now I will flush data to the tty in packages of no more than
* 64 bytes, to ensure I do not get throttled.
* Ask USB mailing list for better aproach.
*/
tty = port->tty;

if (!tty)
schedule_work(&priv->rx_work);

count = min(64, serial_buf_data_avail(priv->rx_buf));

if (count <= 0)
return; //We have finished sending everything.

tty_prepare_flip_string(tty, &data, count);
...

<-- snip -->

"tty" is first checked for being !NULL, but later it's unconditionally
dereferenced.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-11 17:15    [W:2.613 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site