lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 443/772] hinic: Avoid some over memory allocation
    Date
    From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

    [ Upstream commit 15d221d0c345b76947911a3ac91897ffe2f1cc4e ]

    '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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c
    index f7dc7d825f63..4daf6bf291ec 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;

    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-07 23:19    [W:2.480 / U:0.288 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site