summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorGuoqing Jiang <guoqing.jiang@linux.dev>2022-11-17 18:19:41 +0800
committerLeon Romanovsky <leon@kernel.org>2022-11-17 13:47:28 +0200
commitf5708e6699c230f64736107c90b63a53bdc0a613 (patch)
tree7956068a1703fb4e25f03892ab6470673e06a27d /drivers/infiniband
parent102d2f70ec0999a5cde181f1ccbe8a81cba45b10 (diff)
downloadlinux-f5708e6699c230f64736107c90b63a53bdc0a613.tar.bz2
RDMA/rtrs-clt: Correct the checking of ib_map_mr_sg
We should check with count, also the only successful case is that all sg elements are mapped, so make it explicitly. Acked-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> Link: https://lore.kernel.org/r/20221117101945.6317-5-guoqing.jiang@linux.dev Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/rtrs/rtrs-clt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 8546b8816524..be7c8480f947 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -1064,10 +1064,8 @@ static int rtrs_map_sg_fr(struct rtrs_clt_io_req *req, size_t count)
/* Align the MR to a 4K page size to match the block virt boundary */
nr = ib_map_mr_sg(req->mr, req->sglist, count, NULL, SZ_4K);
- if (nr < 0)
- return nr;
- if (nr < req->sg_cnt)
- return -EINVAL;
+ if (nr != count)
+ return nr < 0 ? nr : -EINVAL;
ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey));
return nr;