netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mw@semihalf.com
Cc: netdev@vger.kernel.org
Subject: re: net: mvpp2: fix missing DMA region unmap in egress processing
Date: Tue, 8 Dec 2015 22:38:46 +0300	[thread overview]
Message-ID: <20151208193846.GA25726@mwanda> (raw)

Hello Marcin Wojtas,

The patch e864b4c7b184: "net: mvpp2: fix missing DMA region unmap in
egress processing" from Dec 3, 2015, leads to the following static
checker warning:

	drivers/net/ethernet/marvell/mvpp2.c:4414 mvpp2_txq_bufs_free()
	warn: variable dereferenced before check 'skb' (see line 4412)

drivers/net/ethernet/marvell/mvpp2.c
  4399  static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
  4400                                  struct mvpp2_tx_queue *txq,
  4401                                  struct mvpp2_txq_pcpu *txq_pcpu, int num)
  4402  {
  4403          int i;
  4404  
  4405          for (i = 0; i < num; i++) {
  4406                  dma_addr_t buf_phys_addr =
  4407                                      txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
  4408                  struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
  4409  
  4410                  mvpp2_txq_inc_get(txq_pcpu);
  4411  
  4412                  dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
  4413                                   skb_headlen(skb), DMA_TO_DEVICE);
                                         ^^^^^^^^^^^^^^^^
Dereference inside function.

  4414                  if (!skb)
                            ^^^^^
Check too late.  There is no way that patch can be fix a bug, the best
case is that it does nothing or maybe it adds an oops...

  4415                          continue;
  4416                  dev_kfree_skb_any(skb);
  4417          }
  4418  }


regards,
dan carpenter

                 reply	other threads:[~2015-12-08 19:39 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=20151208193846.GA25726@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=mw@semihalf.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;
as well as URLs for NNTP newsgroup(s).