drivers/staging/ks7010/ks_hostif.c:504:69-72: ERROR: skb is NULL but dereferenced.

From: kbuild test robot
Date: Wed Jul 27 2016 - 09:03:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0e06f5c0deeef0332a5da2ecb8f1fcf3e024d958
commit: 13a9930d15b424ab7d3b906af8ba7ff8c409edfe staging: ks7010: add driver from Nanonote extra-repository
date: 7 weeks ago


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/ks7010/ks_hostif.c:504:69-72: ERROR: skb is NULL but dereferenced.
drivers/staging/ks7010/ks_hostif.c:536:69-72: ERROR: skb is NULL but dereferenced.

vim +504 drivers/staging/ks7010/ks_hostif.c

488 memcpy(skb_put(skb,rx_ind_size-12),priv->rxp+18,rx_ind_size-12); /* copy after Type */
489
490 aa1x_hdr=(struct ieee802_1x_hdr *)(priv->rxp+20);
491 if(aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && priv->wpa.rsn_enabled){
492 eap_key = (struct wpa_eapol_key *)(aa1x_hdr+1);
493 atomic_set(&priv->psstatus.snooze_guard, 1);
494 }
495
496 /* rx indication */
497 skb->dev = priv->net_dev;
498 skb->protocol = eth_type_trans (skb, skb->dev);
499 priv->nstats.rx_packets++;
500 priv->nstats.rx_bytes += rx_ind_size;
501 skb->dev->last_rx = jiffies;
502 netif_rx (skb);
503 } else {
> 504 printk (KERN_WARNING"%s: Memory squeeze, dropping packet.\n",skb->dev->name);
505 priv->nstats.rx_dropped++;
506 }
507 break;
508 case 0xF0: /* NETBEUI/NetBIOS */
509 rx_ind_size = (priv->rx_size + 2);
510 skb = dev_alloc_skb (rx_ind_size);
511 DPRINTK(3,"NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size);
512

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation