summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2020-12-16 13:07:53 +0300
committerJason Gunthorpe <jgg@nvidia.com>2021-01-07 21:31:40 +0300
commit3c638cdb8ecc0442552156e0fed8708dd2c7f35b (patch)
tree4d334d2380dc21cf59d9ad1b5245aed5dd128f57 /drivers/infiniband
parent8ae291cc95e49011b736b641b0cfad502b7a1526 (diff)
downloadlinux-3c638cdb8ecc0442552156e0fed8708dd2c7f35b.tar.xz
RDMA/restrack: Don't treat as an error allocation ID wrapping
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: fd47c2f99f04 ("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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/restrack.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c
index e0a41c867002..ff1551b3cf61 100644
--- a/drivers/infiniband/core/restrack.c
+++ b/drivers/infiniband/core/restrack.c
@@ -254,6 +254,7 @@ 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;
}
out: