Skip to contentSkip to conversation

IB/core: Fix wrong iterating on ports

PATCH Applied Leon Romanovsky 2 participants 2 messages Oct 2, 2019 – Oct 4, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/core: Fix wrong iterating on ports

From: Mohamad Heib <[email protected]>

rdma_for_each_port is already incrementing the iterator's value it receives therefore, after the first iteration the iterator is increased by 2 which eventually causing wrong queries and possible traces.

Fix the above by removing the old redundant incrementation that was used before rdma_for_each_port() macro.

Fixes ea1075edcbab ("RDMA: Add and use rdma_for_each_port")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/security.c +1 -1
index 1ab423b19f77..6eb6d2717ca5 100644
@@ -426,7 +426,7 @@ int ib_create_qp_security(struct ib_qp *qp, struct ib_device *dev)
 	int ret;
 
 	rdma_for_each_port (dev, i) {
-		is_ib = rdma_protocol_ib(dev, i++);
+		is_ib = rdma_protocol_ib(dev, i);
 		if (is_ib)
 			break;
 	}
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Leon Romanovsky

From: Mohamad Heib <[email protected]>

rdma_for_each_port is already incrementing the iterator's value it receives therefore, after the first iteration the iterator is increased by 2 which eventually causing wrong queries and possible traces.

Fix the above by removing the old redundant incrementation that was used before rdma_for_each_port() macro.

Quoted 7 lines
Fixes ea1075edcbab ("RDMA: Add and use rdma_for_each_port")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason