public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: netdev@vger.kernel.org
Subject: dl2k: potential null dereference in recieve_packet()
Date: Sun, 19 Jul 2009 14:59:24 +0300 (EAT)	[thread overview]
Message-ID: <alpine.DEB.2.00.0907171612530.12306@bicker> (raw)

Hello,

Smatch (http://repo.or.cz/w/smatch.git) found a potential null dereference 
in drivers/net/dl2k.c receive_packet().  If the allocation on line 874 
fails we still dereference skb on line 890.

drivers/net/dl2k.c 
   874                          } else if ((skb = netdev_alloc_skb(dev, pkt_len + 2))) {
   875                                  pci_dma_sync_single_for_cpu(np->pdev,
   876                                                              desc_to_dma(desc),
   877                                                              np->rx_buf_sz,
   878                                                              PCI_DMA_FROMDEVICE);
   879                                  /* 16 byte align the IP header */
   880                                  skb_reserve (skb, 2);
   881                                  skb_copy_to_linear_data (skb,
   882                                                    np->rx_skbuff[entry]->data,
   883                                                    pkt_len);
   884                                  skb_put (skb, pkt_len);
   885                                  pci_dma_sync_single_for_device(np->pdev,
   886                                                                 desc_to_dma(desc),
   887                                                                 np->rx_buf_sz,
   888                                                                 PCI_DMA_FROMDEVICE);
   889                          }
   890                          skb->protocol = eth_type_trans (skb, dev);

regards,
dan carpenter


                 reply	other threads:[~2009-07-19 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.00.0907171612530.12306@bicker \
    --to=error27@gmail.com \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox