[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B82435381E3B2943AA4D2826ADEF0B3A022B739C@DGGEML502-MBS.china.huawei.com>
Date: Sat, 28 Mar 2020 02:15:14 +0000
From: liweihang <liweihang@...wei.com>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
oulijun <oulijun@...wei.com>,
"Huwei (Xavier)" <huwei87@...ilicon.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>,
"wangxi (M)" <wangxi11@...wei.com>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] RDMA/hns: Fix uninitialized variable bug
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@...eddedor.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,
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.
Weihang
Powered by blists - more mailing lists