net: stmmac: Two fixes
Subsystems (4)
cover net: stmmac: Two fixes
Two fixes targeting -net.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Jose Abreu (2):
net: stmmac: RX Descriptors need to be clean before setting buffers
net: stmmac: Use kcalloc() instead of kmalloc_array()
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
Signature · 1 line
2.7.4
PATCH 2/2 net: stmmac: Use kcalloc() instead of kmalloc_array()
We need the memory to be zeroed upon allocation so use kcalloc() instead.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -9
@@ -1555,9 +1555,8 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv) goto err_dma; } - rx_q->buf_pool =kmalloc_array (DMA_RX_SIZE , -sizeof (*rx_q->buf_pool), -GFP_KERNEL ); + rx_q->buf_pool =kcalloc (DMA_RX_SIZE ,sizeof (*rx_q->buf_pool), +GFP_KERNEL );if (!rx_q->buf_pool) goto err_dma;
@@ -1608,15 +1607,15 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) tx_q->queue_index = queue; tx_q->priv_data = priv; - tx_q->tx_skbuff_dma =kmalloc_array (DMA_TX_SIZE , -sizeof (*tx_q->tx_skbuff_dma), -GFP_KERNEL ); + tx_q->tx_skbuff_dma =kcalloc (DMA_TX_SIZE , +sizeof (*tx_q->tx_skbuff_dma), +GFP_KERNEL );if (!tx_q->tx_skbuff_dma) goto err_dma; - tx_q->tx_skbuff =kmalloc_array (DMA_TX_SIZE , -sizeof (struct sk_buff *), -GFP_KERNEL ); + tx_q->tx_skbuff =kcalloc (DMA_TX_SIZE , +sizeof (struct sk_buff *), +GFP_KERNEL );if (!tx_q->tx_skbuff) goto err_dma;
Signature · 1 line
2.7.4
PATCH 1/2 net: stmmac: RX Descriptors need to be clean before setting buffers
In reply to Jose AbreuRX Descriptors are being cleaned after setting the buffers which may lead to buffer addresses being wiped out.
Fix this by clearing earlier the RX Descriptors.
---
Cc: Giuseppe Cavallaro <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Jose Abreu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -1295,6 +1295,8 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)"(%s) dma_rx_phy=0x%08x\n" , __func__, (u32)rx_q->dma_rx_phy); +stmmac_clear_rx_descriptors (priv, queue); +for (i =0 ; i <DMA_RX_SIZE ; i++) {struct dma_desc *p;
@@ -1312,8 +1314,6 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) rx_q->cur_rx =0 ; rx_q->dirty_rx = (unsigned int )(i -DMA_RX_SIZE ); -stmmac_clear_rx_descriptors (priv, queue); -/* Setup the chained descriptor addresses */ if (priv->mode ==STMMAC_CHAIN_MODE ) {if (priv->extend_desc)
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Jose Abreu <[email protected]>
Date: Mon, 22 Jul 2019 10:39:29 +0200
Quoted 1 line
Two fixes targeting -net.
Series applied.