From 5addc88f8f48e92fc7eda91d39b3d01ec26d9002 Mon Sep 17 00:00:00 2001
From: Xiaohui Zhang <xiaohuizhang@ruc.edu.cn>
Date: Sun, 12 Jun 2022 19:16:04 +0800
Subject: [PATCH 1/1] RDMA/cma: Set proper port number as index

Conversion from IDR to XArray missed the fact that idr_alloc() returned
index as a return value, this index was saved in port variable and used as
query index later on. This caused to the following error.

Signed-off-by: Xiaohui Zhang <xiaohuizhang@ruc.edu.cn>
---
 sys/ofed/drivers/infiniband/core/ib_cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c
index 586524ac8..a3b74dff4 100644
--- a/sys/ofed/drivers/infiniband/core/ib_cma.c
+++ b/sys/ofed/drivers/infiniband/core/ib_cma.c
@@ -3170,7 +3170,7 @@ static int cma_alloc_port(enum rdma_port_space ps,
 		goto err;
 
 	bind_list->ps = ps;
-	bind_list->port = (unsigned short)ret;
+	bind_list->port = snum;
 	cma_bind_port(bind_list, id_priv);
 	return 0;
 err:
-- 
2.17.1