lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.19 0726/1157] RDMA/rxe: fix xa_alloc_cycle() error return value check again
    Date
    From: Dongliang Mu <mudongliangabcd@gmail.com>

    [ Upstream commit 1a685940e6200e9def6e34bbaa19dd31dc5aeaf8 ]

    Currently rxe_alloc checks ret to indicate error, but 1 is also a valid
    return and just indicates that the allocation succeeded with a wrap.

    Fix this by modifying the check to be < 0.

    Link: https://lore.kernel.org/r/20220609070656.1446121-1-dzm91@hust.edu.cn
    Fixes: 3225717f6dfa ("RDMA/rxe: Replace red-black trees by xarrays")
    Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
    Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/infiniband/sw/rxe/rxe_pool.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
    index 19b14826385b..e9f3bbd8d605 100644
    --- a/drivers/infiniband/sw/rxe/rxe_pool.c
    +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
    @@ -139,7 +139,7 @@ void *rxe_alloc(struct rxe_pool *pool)

    err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
    &pool->next, GFP_KERNEL);
    - if (err)
    + if (err < 0)
    goto err_free;

    return obj;
    @@ -167,7 +167,7 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)

    err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
    &pool->next, GFP_KERNEL);
    - if (err)
    + if (err < 0)
    goto err_cnt;

    return 0;
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-08-16 06:41    [W:4.834 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site