All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver
Date: Mon, 03 Aug 2015 15:39:21 +0000	[thread overview]
Message-ID: <20150803153921.GA13117@mwanda> (raw)

Hello Woojung.Huh@microchip.com,

This is a semi-automatic email about new static checker warnings.

The patch 55d7de9de6c3: "Microchip's LAN7800 family USB 2/3 to 
10/100/1000 Ethernet device driver" from Jul 30, 2015, leads to the 
following Smatch complaint:

drivers/net/usb/lan78xx.c:2282 tx_complete()
	 warn: variable dereferenced before check 'skb' (see line 2249)

drivers/net/usb/lan78xx.c
  2248		struct sk_buff *skb = (struct sk_buff *)urb->context;
  2249		struct skb_data *entry = (struct skb_data *)skb->cb;
                                                            ^^^^^^^
Dereference.

  2250		struct lan78xx_net *dev = entry->dev;
  2251	
  2252		if (urb->status = 0) {
  2253			dev->net->stats.tx_packets++;
  2254			dev->net->stats.tx_bytes += entry->length;
  2255		} else {
  2256			dev->net->stats.tx_errors++;
  2257	
  2258			switch (urb->status) {
  2259			case -EPIPE:
  2260				lan78xx_defer_kevent(dev, EVENT_TX_HALT);
  2261				break;
  2262	
  2263			/* software-driven interface shutdown */
  2264			case -ECONNRESET:
  2265			case -ESHUTDOWN:
  2266				break;
  2267	
  2268			case -EPROTO:
  2269			case -ETIME:
  2270			case -EILSEQ:
  2271				netif_stop_queue(dev->net);
  2272				break;
  2273			default:
  2274				netif_dbg(dev, tx_err, dev->net,
  2275					  "tx err %d\n", entry->urb->status);
  2276				break;
  2277			}
  2278		}
  2279	
  2280		usb_autopm_put_interface_async(dev->intf);
  2281	
  2282		if (skb)
                    ^^^
Check too late.

  2283			defer_bh(dev, skb, &dev->txq, tx_done);
  2284	}

regards,
dan carpenter

             reply	other threads:[~2015-08-03 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 15:39 Dan Carpenter [this message]
2015-08-03 15:46 ` Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver Dan Carpenter
2015-08-03 15:48 ` Woojung.Huh
2015-08-03 16:06 ` Dan Carpenter
2015-08-03 16:07 ` Woojung.Huh

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=20150803153921.GA13117@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 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.