lkml.org 
[lkml]   [2022]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rxe: fix xa_alloc_cycle() error return value check again
On Thu, Jun 09, 2022 at 03:06:56PM +0800, Dongliang Mu wrote:
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> 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.
>
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
> drivers/infiniband/sw/rxe/rxe_pool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I applied same fix to rxe_alloc() and added Fixes line.

Thanks, applied.

>
> diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
> index 1cc8e847ccff..e9f3bbd8d605 100644
> --- a/drivers/infiniband/sw/rxe/rxe_pool.c
> +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
> @@ -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.25.1
>

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