]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/hns: Fix uninitialized variable
authorYixing Liu <liuyixing1@huawei.com>
Fri, 18 Jun 2021 10:10:12 +0000 (18:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:08:39 +0000 (15:08 +0200)
commit 2a38c0f10e6d7d28e06ff1eb1f350804c4850275 upstream.

A random value will be returned if the condition below is not met, so it
needs to be initialized.

Fixes: 9ea9a53ea93b ("RDMA/hns: Add mapped page count checking for MTR")
Link: https://lore.kernel.org/r/1624011020-16992-3-git-send-email-liweihang@huawei.com
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/hns/hns_roce_mr.c

index 5fad718cfdbe37d229439933f73c52a3e5518cfd..5f038bd5571d16dfc8ca666aec4ea03be6deaf63 100644 (file)
@@ -832,7 +832,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
        struct ib_device *ibdev = &hr_dev->ib_dev;
        struct hns_roce_buf_region *r;
        unsigned int i, mapped_cnt;
-       int ret;
+       int ret = 0;
 
        /*
         * Only use the first page address as root ba when hopnum is 0, this