mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: liweihang <liweihang@huawei.com>, oulijun <oulijun@huawei.com>,
	"Huwei (Xavier)" <huwei87@hisilicon.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"wangxi (M)" <wangxi11@huawei.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] RDMA/hns: Fix uninitialized variable bug
Date: Fri, 27 Mar 2020 21:28:31 -0500	[thread overview]
Message-ID: <36a775c2-2d8c-e735-b4fe-f6cd45b00e3e@embeddedor.com> (raw)
In-Reply-To: <B82435381E3B2943AA4D2826ADEF0B3A022B739C@DGGEML502-MBS.china.huawei.com>



On 3/27/20 21:15, liweihang wrote:
> On 2020/3/28 3:28, Gustavo A. R. Silva wrote:
>> There is a potential execution path in which variable *ret* is returned
>> without being properly initialized, previously.
>>
>> Fix this by initializing variable *ret* to -ENODEV.
>>
>> Addresses-Coverity-ID: 1491917 ("Uninitialized scalar variable")
>> Fixes: 2f49de21f3e9 ("RDMA/hns: Optimize mhop get flow for multi-hop addressing")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_hem.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c
>> index c96378718f88..3fd8100c2b56 100644
>> --- a/drivers/infiniband/hw/hns/hns_roce_hem.c
>> +++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
>> @@ -603,7 +603,7 @@ static int set_mhop_hem(struct hns_roce_dev *hr_dev,
>>  {
>>  	struct ib_device *ibdev = &hr_dev->ib_dev;
>>  	int step_idx;
>> -	int ret;
>> +	int ret = -ENODEV;
>>  
>>  	if (index->inited & HEM_INDEX_L0) {
>>  		ret = hr_dev->hw->set_hem(hr_dev, table, obj, 0);
>>
> 
> Hi Gustavo,
> 

Hi Weihang,

> Thanks for your modification. But I check the code and I think "ret"
> should be initialized to 0, which means no need to set hem and it is
> not an error.
> 

Oh, I see. Thanks for the feedback. I'll send v2 shortly.

Thanks
--
Gustavo

  reply	other threads:[~2020-03-28  2:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 19:31 Gustavo A. R. Silva
2020-03-28  2:15 ` liweihang
2020-03-28  2:28   ` Gustavo A. R. Silva [this message]
2020-03-28 12:40   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36a775c2-2d8c-e735-b4fe-f6cd45b00e3e@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=dledford@redhat.com \
    --cc=huwei87@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liweihang@huawei.com \
    --cc=oulijun@huawei.com \
    --cc=wangxi11@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®