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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to