diff mbox series

RDMA/rtrs: fix uninitialized symbol 'cnt'

Message ID 20210429092741.266533-1-gi-oh.kim@ionos.com (mailing list archive)
State New, archived
Headers show
Series RDMA/rtrs: fix uninitialized symbol 'cnt' | expand

Commit Message

Gioh Kim April 29, 2021, 9:27 a.m. UTC
rtrs_clt_rdma_cq_direct returns an ninitialized value in cnt
if there is no session. This patch makes rtrs_clt_rdma_cq_direct
returns a negative value for block layer not to try again.

Fixes: 2958a995edc94 ("block/rnbd-clt: Support polling mode for IO latency optimization")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Axboe April 29, 2021, 2:28 p.m. UTC | #1
On 4/29/21 3:27 AM, Gioh Kim wrote:
> rtrs_clt_rdma_cq_direct returns an ninitialized value in cnt
> if there is no session. This patch makes rtrs_clt_rdma_cq_direct
> returns a negative value for block layer not to try again.

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index b74a872387c4..934a2ff18e7f 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2896,7 +2896,8 @@  EXPORT_SYMBOL(rtrs_clt_request);
 
 int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, unsigned int index)
 {
-	int cnt;
+	/* If no path, return -1 for block layer not to try again */
+	int cnt = -1;
 	struct rtrs_con *con;
 	struct rtrs_clt_sess *sess;
 	struct path_it it;