Discussion:
net: sxgbe: add basic framework for Samsung 10Gb ethernet driver
Dan Carpenter
2014-10-15 13:53:54 UTC
Permalink
Hello Siva Reddy,

The patch 1edb9ca69e8a: "net: sxgbe: add basic framework for Samsung
10Gb ethernet driver" from Mar 25, 2014, leads to the following
static checker warning:

drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c:505 init_rx_ring()
warning: passing freed memory 'rx_ring->rx_skbuff'

drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
500 return 0;
501
502 err_init_rx_buffers:
503 while (--desc_index >= 0)
504 free_rx_ring(priv->device, rx_ring, desc_index);
^^^^^^^
We free "rx_ring->rx_skbuff" and "rx_ring->rx_skbuff_dma" here so the
next two kfree() calls are double frees.

505 kfree(rx_ring->rx_skbuff);
506 rxbuff_err:
507 kfree(rx_ring->rx_skbuff_dma);
508 dmamem_err:
509 dma_free_coherent(priv->device,
510 rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
511 rx_ring->dma_rx, rx_ring->dma_rx_phy);
512 error:
513 return -ENOMEM;
514 }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Dan Carpenter
2014-10-15 14:15:41 UTC
Permalink
Silva's email bounces.
Post by Dan Carpenter
Hello Siva Reddy,
The patch 1edb9ca69e8a: "net: sxgbe: add basic framework for Samsung
10Gb ethernet driver" from Mar 25, 2014, leads to the following
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c:505 init_rx_ring()
warning: passing freed memory 'rx_ring->rx_skbuff'
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
500 return 0;
501
503 while (--desc_index >= 0)
504 free_rx_ring(priv->device, rx_ring, desc_index);
^^^^^^^
We free "rx_ring->rx_skbuff" and "rx_ring->rx_skbuff_dma" here so the
next two kfree() calls are double frees.
505 kfree(rx_ring->rx_skbuff);
507 kfree(rx_ring->rx_skbuff_dma);
509 dma_free_coherent(priv->device,
510 rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
511 rx_ring->dma_rx, rx_ring->dma_rx_phy);
513 return -ENOMEM;
514 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...