sh_eth_ring_free()  called in the sh_eth_ring_init()'s error path  expects
the arrays pointed  by sh_eth_private::[rt]x_skbuff to be initialized with
NULLs  but they are allocated with just kmalloc_array() and so left filled
with random data. Use kcalloc() instead.

Signed-off-by: Sergei Shtylyov <sergei.shtyl...@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1212,15 +1212,15 @@ static int sh_eth_ring_init(struct net_d
                mdp->rx_buf_sz += NET_IP_ALIGN;
 
        /* Allocate RX and TX skb rings */
-       mdp->rx_skbuff = kmalloc_array(mdp->num_rx_ring,
-                                      sizeof(*mdp->rx_skbuff), GFP_KERNEL);
+       mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff),
+                                GFP_KERNEL);
        if (!mdp->rx_skbuff) {
                ret = -ENOMEM;
                return ret;
        }
 
-       mdp->tx_skbuff = kmalloc_array(mdp->num_tx_ring,
-                                      sizeof(*mdp->tx_skbuff), GFP_KERNEL);
+       mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),
+                                GFP_KERNEL);
        if (!mdp->tx_skbuff) {
                ret = -ENOMEM;
                goto skb_ring_free;

--
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