Skip to contentSkip to conversation

RDMA/rdmavt: fix error code in rvt_create_qp()

PATCH Applied Dan Carpenter 3 participants 3 messages Oct 13, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/rdmavt: fix error code in rvt_create_qp()

Return negative -ENOMEM instead of positive ENOMEM. Returning a postive value will cause an Oops because it becomes an ERR_PTR() in the create_qp() function.

Fixes 514aee660df4 ("RDMA: Globally allocate and release QP memory")
---
 drivers/infiniband/sw/rdmavt/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +1 -1
index 49bdd78ac664..3305f2744bfa 100644
@@ -1223,7 +1223,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
 	spin_lock(&rdi->n_qps_lock);
 	if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) {
 		spin_unlock(&rdi->n_qps_lock);
-		ret = ENOMEM;
+		ret = -ENOMEM;
 		goto bail_ip;
 	}
 
Signature · 1 line
2.20.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dan Carpenter

Return negative -ENOMEM instead of positive ENOMEM. Returning a postive value will cause an Oops because it becomes an ERR_PTR() in the create_qp() function.

Fixes 514aee660df4 ("RDMA: Globally allocate and release QP memory")
---
 drivers/infiniband/sw/rdmavt/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +0 -0
index 49bdd78ac664..3305f2744bfa 100644

drivers/infiniband/sw/rdmavt/qp.c int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr, · line 1229

Quoted 8 lines
drivers/infiniband/sw/rdmavt/qp.c +1 -1
@@ -1223,7 +1223,7 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
 	spin_lock(&rdi->n_qps_lock);
 	if (rdi->n_qps_allocated == rdi->dparms.props.max_qp) {
 		spin_unlock(&rdi->n_qps_lock);
-		ret = ENOMEM;
+		ret = -ENOMEM;
 		goto bail_ip;
 	}
 

Thanks Dan.

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter

Return negative -ENOMEM instead of positive ENOMEM. Returning a postive value will cause an Oops because it becomes an ERR_PTR() in the create_qp() function.

Fixes 514aee660df4 ("RDMA: Globally allocate and release QP memory")
---
 drivers/infiniband/sw/rdmavt/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason