Skip to content

Commit

Permalink
hinic: Avoid some over memory allocation
Browse files Browse the repository at this point in the history
[ Upstream commit 15d221d ]

'prod_idx' (atomic_t) is larger than 'shadow_idx' (u16), so some memory is
over-allocated.

Fixes: b15a9f3 ("net-next/hinic: Add wq")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Jun 9, 2022
1 parent dc7753d commit 8096e2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,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;

Expand Down

0 comments on commit 8096e2d

Please sign in to comment.