* [PATCH] rxe: fix xa_alloc_cycle() error return value check again
@ 2022-06-09 7:06 Dongliang Mu
2022-06-16 8:57 ` Leon Romanovsky
0 siblings, 1 reply; 4+ messages in thread
From: Dongliang Mu @ 2022-06-09 7:06 UTC (permalink / raw)
To: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky
Cc: Dongliang Mu, linux-rdma, linux-kernel
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(-)
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rxe: fix xa_alloc_cycle() error return value check again
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
2022-08-05 11:21 ` William Kucharski
0 siblings, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2022-06-16 8:57 UTC (permalink / raw)
To: Dongliang Mu
Cc: Zhu Yanjun, Jason Gunthorpe, Dongliang Mu, linux-rdma, linux-kernel
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rxe: fix xa_alloc_cycle() error return value check again
2022-06-16 8:57 ` Leon Romanovsky
@ 2022-08-05 11:21 ` William Kucharski
2022-08-05 12:12 ` Jason Gunthorpe
0 siblings, 1 reply; 4+ messages in thread
From: William Kucharski @ 2022-08-05 11:21 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Dongliang Mu, Zhu Yanjun, Jason Gunthorpe, Dongliang Mu,
linux-rdma, linux-kernel
I erroneously sent a duplicate of this patch last week because I didn't see the fix in the 5.19 kernel as of yet.
Do we know when it might be pulled into Linus' tree?
Thanks,
William Kucharski
> On Jun 16, 2022, at 2:57 AM, Leon Romanovsky <leon@kernel.org> wrote:
>
> 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
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rxe: fix xa_alloc_cycle() error return value check again
2022-08-05 11:21 ` William Kucharski
@ 2022-08-05 12:12 ` Jason Gunthorpe
0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2022-08-05 12:12 UTC (permalink / raw)
To: William Kucharski
Cc: Leon Romanovsky, Dongliang Mu, Zhu Yanjun, Dongliang Mu,
linux-rdma, linux-kernel
On Fri, Aug 05, 2022 at 11:21:53AM +0000, William Kucharski wrote:
> I erroneously sent a duplicate of this patch last week because I didn't see the fix in the 5.19 kernel as of yet.
>
> Do we know when it might be pulled into Linus' tree?
Yesterday
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-05 12:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-08-05 11:21 ` William Kucharski
2022-08-05 12:12 ` Jason Gunthorpe
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).