RDMA/restrack: Don't treat as an error allocation ID wrapping
PATCH 1/1 RDMA/restrack: Don't treat as an error allocation ID wrapping
From: Leon Romanovsky <[email protected]>
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")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Leon Romanovsky <[email protected]>
--- drivers/infiniband/core/restrack.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/restrack.c +1 -0
@@ -257,6 +257,7 @@ int rdma_restrack_add(struct rdma_restrack_entry *res)default : ret =xa_alloc_cyclic (&rt->xa, &res->id, res, xa_limit_32b, &rt->next_id,GFP_KERNEL ); + ret = (ret <0 ) ? ret :0 ; }if (ret) { ibdev_err(
Signature · 1 line
2.29.2
Quoted 9 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
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:261rdma_restrack_add()
warn: 'ret' can be either negative or positive
Quoted 6 lines
Fixes fd47c2f99f04 ("RDMA/restrack: Convert internal DB from hash to XArray")Reported-by Dan Carpenter <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/core/restrack.c | 1 + 1 file changed, 1 insertion(+)
Applied to for-rc, thanks
Jason