* drivers/usb/serial/aircable.c: inconsequent NULL checking
@ 2006-11-11 16:13 Adrian Bunk
[not found] ` <360bc8300611151008v44e12cebx65688233fc614906@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2006-11-11 16:13 UTC (permalink / raw)
To: Manuel Francisco Naranjo; +Cc: gregkh, linux-usb-devel, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: drivers/usb/serial/aircable.c: inconsequent NULL checking
[not found] ` <360bc8300611151008v44e12cebx65688233fc614906@mail.gmail.com>
@ 2006-11-15 18:14 ` Naranjo Manuel Francisco
0 siblings, 0 replies; 2+ messages in thread
From: Naranjo Manuel Francisco @ 2006-11-15 18:14 UTC (permalink / raw)
To: bunk; +Cc: gregkh, linux-usb-devel, linux-kernel
> 2006/11/11, Adrian Bunk <bunk@stusta.de>:
> > The Coverity checker spotted the following in
> > drivers/usb/serial/aircable.c:
> >
> > <-- snip -->
> >
> > ...
> > static void aircable_read(void *params)
> > {
> > ...
Hi everyone,
Sorry for the long time response but here is the patch, I think this way should work, if anyone has any suggestion let me know. What I do now is, in case I don't have the tty available I reschedule the work, I have tried it and it works with no problem, I even tried removing the device, and didn't find anything strange.
Manuel Naranjo
Signed-off-by: Naranjo Manuel <naranjo.manuel@gmail.com>
----
--- linux2/drivers/usb/serial/aircable.c.orig 2006-11-15 15:03:40.000000000 -0300
+++ linux2/drivers/usb/serial/aircable.c 2006-11-12 21:59:05.000000000 -0300
@@ -270,8 +270,11 @@ static void aircable_read(void *params)
*/
tty = port->tty;
- if (!tty)
+ if (!tty){
schedule_work(&priv->rx_work);
+ err("%s - No tty available", __FUNCTION__);
+ return ;
+ }
count = min(64, serial_buf_data_avail(priv->rx_buf));
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-15 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-11 16:13 drivers/usb/serial/aircable.c: inconsequent NULL checking Adrian Bunk
[not found] ` <360bc8300611151008v44e12cebx65688233fc614906@mail.gmail.com>
2006-11-15 18:14 ` Naranjo Manuel Francisco
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.