From: Christophe JAILLET Date: Sat, 21 May 2022 06:33:01 +0000 (+0200) Subject: hinic: Avoid some over memory allocation X-Git-Tag: v6.6.17~7361^2~10^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15d221d0c345b76947911a3ac91897ffe2f1cc4e;p=platform%2Fkernel%2Flinux-rpi.git hinic: Avoid some over memory allocation '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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c index f7dc7d8..4daf6bf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c @@ -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;