hinic: Avoid some over memory allocation
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 21 May 2022 06:33:01 +0000 (08:33 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 May 2022 20:47:57 +0000 (21:47 +0100)
'prod_idx' (atomic_t) is larger than 'shadow_idx' (u16), so some memory is
over-allocated.

Fixes: b15a9f37be2b ("net-next/hinic: Add wq")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c

index f7dc7d8..4daf6bf 100644 (file)
@@ -386,7 +386,7 @@ static int alloc_wqes_shadow(struct hinic_wq *wq)
                return -ENOMEM;
 
        wq->shadow_idx = devm_kcalloc(&pdev->dev, wq->num_q_pages,
-                                     sizeof(wq->prod_idx), GFP_KERNEL);
+                                     sizeof(*wq->shadow_idx), GFP_KERNEL);
        if (!wq->shadow_idx)
                goto err_shadow_idx;