linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dongliang Mu <dzm91@hust.edu.cn>
Cc: Zhu Yanjun <zyjzyj2000@gmail.com>, Jason Gunthorpe <jgg@ziepe.ca>,
	Dongliang Mu <mudongliangabcd@gmail.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rxe: fix xa_alloc_cycle() error return value check again
Date: Thu, 16 Jun 2022 11:57:45 +0300	[thread overview]
Message-ID: <YqrwibTkaDig+QfI@unreal> (raw)
In-Reply-To: <20220609070656.1446121-1-dzm91@hust.edu.cn>

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
> 

  reply	other threads:[~2022-06-16  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  7:06 [PATCH] rxe: fix xa_alloc_cycle() error return value check again Dongliang Mu
2022-06-16  8:57 ` Leon Romanovsky [this message]
2022-08-05 11:21   ` William Kucharski
2022-08-05 12:12     ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YqrwibTkaDig+QfI@unreal \
    --to=leon@kernel.org \
    --cc=dzm91@hust.edu.cn \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).