Skip to contentSkip to conversation

RDMA/hns: return 0 rather than return a garbage status value

PATCH Applied Colin King 3 participants 3 messages Sep 29, 2017 – Oct 4, 2017

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 RDMA/hns: return 0 rather than return a garbage status value

From: Colin Ian King <[email protected]>

For the case where hr_qp->state = IB_QPS_RESET, an uninitialized value in ret is being returned by function hns_roce_v2_query_qp. Fix this by setting ret to 0 for this specific return condition.

Detected by CoverityScan, CID#1457203 ("Unitialized scalar variable")

---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
index 4870b51caab9..791dae72e775 100644
@@ -2805,6 +2805,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 
 	if (hr_qp->state = IB_QPS_RESET) {
 		qp_attr->qp_state = IB_QPS_RESET;
+		ret = 0;
 		goto done;
 	}
 
Signature · 1 line
2.14.1
Acked-by on v1 1/1
#1 lore raw

Thanks, Colin Ian King

Quoted 25 lines · Colin King

From: Colin Ian King <[email protected]>

For the case where hr_qp->state = IB_QPS_RESET, an uninitialized value in ret is being returned by function hns_roce_v2_query_qp. Fix this by setting ret to 0 for this specific return condition.

Detected by CoverityScan, CID#1457203 ("Unitialized scalar variable")

---
  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 +
  1 file changed, 1 insertion(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
index 4870b51caab9..791dae72e775 100644
@@ -2805,6 +2805,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 
  	if (hr_qp->state = IB_QPS_RESET) {
  		qp_attr->qp_state = IB_QPS_RESET;
+		ret = 0;
  		goto done;
  	}
 
Applied
#2 lore raw
In reply to Colin King
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

For the case where hr_qp->state = IB_QPS_RESET, an uninitialized value in ret is being returned by function hns_roce_v2_query_qp. Fix this by setting ret to 0 for this specific return condition.

Detected by CoverityScan, CID#1457203 ("Unitialized scalar variable")

Thanks, applied.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD