]> Git Repo - linux.git/commitdiff
RDMA/hns: Fix uninitialized variable bug
authorGustavo A. R. Silva <[email protected]>
Sat, 28 Mar 2020 02:35:39 +0000 (21:35 -0500)
committerJason Gunthorpe <[email protected]>
Sun, 29 Mar 2020 14:09:55 +0000 (11:09 -0300)
There is a potential execution path in which variable *ret* is returned
without being properly initialized, previously.

Fix this by initializing variable *ret* to 0.

Link: https://lore.kernel.org/r/20200328023539.GA32016@embeddedor
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 <[email protected]>
Acked-by: Weihang Li <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
drivers/infiniband/hw/hns/hns_roce_hem.c

index c96378718f881d43c91b80c955fc711010146a2b..263338b90d7ac3bf2428fe93690ee2d0a2f9bb12 100644 (file)
@@ -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 = 0;
 
        if (index->inited & HEM_INDEX_L0) {
                ret = hr_dev->hw->set_hem(hr_dev, table, obj, 0);
This page took 0.057374 seconds and 4 git commands to generate.