diff mbox

RDMA/hns: Fix uninitialized variable in hns_roce_v2_query_qp()

Message ID 20171003105418.jpthrfu7j7ojk5fg@mwanda (mailing list archive)
State Not Applicable
Headers show

Commit Message

Dan Carpenter Oct. 3, 2017, 10:54 a.m. UTC
We accidentally return an uninitialized value if
(hr_qp->state == IB_QPS_RESET).  We should be returning success.

Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Doug Ledford Oct. 4, 2017, 7:15 p.m. UTC | #1
On Tue, 2017-10-03 at 13:54 +0300, Dan Carpenter wrote:
> We accidentally return an uninitialized value if
> (hr_qp->state == IB_QPS_RESET).  We should be returning success.
> 
> Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08
> SoC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Hi Dan, I already took in another patch that solves the same issue. 
Thanks.

> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index 4171f73bdad5..e1c59dc066c9 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -2792,7 +2792,7 @@ static int hns_roce_v2_query_qp(struct ib_qp
> *ibqp, struct ib_qp_attr *qp_attr,
>  	struct device *dev = hr_dev->dev;
>  	int tmp_qp_state;
>  	int state;
> -	int ret;
> +	int ret = 0;
>  
>  	context = kzalloc(sizeof(*context), GFP_KERNEL);
>  	if (!context)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 4171f73bdad5..e1c59dc066c9 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -2792,7 +2792,7 @@  static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 	struct device *dev = hr_dev->dev;
 	int tmp_qp_state;
 	int state;
-	int ret;
+	int ret = 0;
 
 	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context)