mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Manuel Francisco Naranjo <naranjo.manuel@gmail.com>
Cc: gregkh@suse.de, linux-usb-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: drivers/usb/serial/aircable.c: inconsequent NULL checking
Date: Sat, 11 Nov 2006 17:13:00 +0100	[thread overview]
Message-ID: <20061111161300.GB8809@stusta.de> (raw)

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


             reply	other threads:[~2006-11-11 16:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11 16:13 Adrian Bunk [this message]
     [not found] ` <360bc8300611151008v44e12cebx65688233fc614906@mail.gmail.com>
2006-11-15 18:14   ` Naranjo Manuel Francisco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061111161300.GB8809@stusta.de \
    --to=bunk@stusta.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=naranjo.manuel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome