From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wei Hu (Xavier)" Date: Sat, 30 Sep 2017 07:11:05 +0000 Subject: Re: [PATCH] RDMA/hns: return 0 rather than return a garbage status value Message-Id: <59CF4389.6050103@huawei.com> List-Id: References: <20170929201308.4704-1-colin.king@canonical.com> In-Reply-To: <20170929201308.4704-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Colin King , Doug Ledford , Sean Hefty Cc: Lijun Ou , Hal Rosenstock , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Thanks, Colin Ian King Acked-by: Wei Hu (Xavier) On 2017/9/30 4:13, Colin King wrote: > From: Colin Ian King > > 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") > > Signed-off-by: Colin Ian King > --- > drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > index 4870b51caab9..791dae72e775 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > @@ -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; > } > From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wei Hu (Xavier)" Subject: Re: [PATCH] RDMA/hns: return 0 rather than return a garbage status value Date: Sat, 30 Sep 2017 15:11:05 +0800 Message-ID: <59CF4389.6050103@huawei.com> References: <20170929201308.4704-1-colin.king@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170929201308.4704-1-colin.king@canonical.com> Sender: linux-kernel-owner@vger.kernel.org To: Colin King , Doug Ledford , Sean Hefty Cc: Lijun Ou , Hal Rosenstock , linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-rdma@vger.kernel.org Thanks, Colin Ian King Acked-by: Wei Hu (Xavier) On 2017/9/30 4:13, Colin King wrote: > From: Colin Ian King > > 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") > > Signed-off-by: Colin Ian King > --- > drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > index 4870b51caab9..791dae72e775 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > @@ -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; > } > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbdI3HLt (ORCPT ); Sat, 30 Sep 2017 03:11:49 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7512 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751482AbdI3HLr (ORCPT ); Sat, 30 Sep 2017 03:11:47 -0400 Subject: Re: [PATCH] RDMA/hns: return 0 rather than return a garbage status value To: Colin King , Doug Ledford , Sean Hefty References: <20170929201308.4704-1-colin.king@canonical.com> CC: Lijun Ou , Hal Rosenstock , , , From: "Wei Hu (Xavier)" Message-ID: <59CF4389.6050103@huawei.com> Date: Sat, 30 Sep 2017 15:11:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20170929201308.4704-1-colin.king@canonical.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.115.182] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.59CF43A3.0098,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a34829764f82654e29b27dd3698a10ff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks, Colin Ian King Acked-by: Wei Hu (Xavier) On 2017/9/30 4:13, Colin King wrote: > From: Colin Ian King > > 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") > > Signed-off-by: Colin Ian King > --- > drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > index 4870b51caab9..791dae72e775 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c > @@ -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; > } >