mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
RDMA/restrack: Don't treat as an error allocation ID wrapping
commit3c638cdb8eupstream. xa_alloc_cyclic() call returns positive number if ID allocation succeeded but wrapped. It is not an error, so normalize the "ret" variable to zero as marker of not-an-error. drivers/infiniband/core/restrack.c:261 rdma_restrack_add() warn: 'ret' can be either negative or positive Fixes:fd47c2f99f("RDMA/restrack: Convert internal DB from hash to XArray") Link: https://lore.kernel.org/r/20201216100753.1127638-1-leon@kernel.org Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
986fdc7685
commit
da834a9bdc
@@ -234,6 +234,7 @@ static void rdma_restrack_add(struct rdma_restrack_entry *res)
|
||||
} else {
|
||||
ret = xa_alloc_cyclic(&rt->xa, &res->id, res, xa_limit_32b,
|
||||
&rt->next_id, GFP_KERNEL);
|
||||
ret = (ret < 0) ? ret : 0;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
|
||||
Reference in New Issue
Block a user