Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741181

[PATCH for-next 6/9] RDMA/hns: Add return statement when checking error in hns_roce_v1_mr_free_work_fn

From "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
Newsgroups linux.kernel
Subject [PATCH for-next 6/9] RDMA/hns: Add return statement when checking error in hns_roce_v1_mr_free_work_fn
Date 2017-09-28 06:40 +0200
Message-ID <uuyMa-4cw-35@gated-at.bofh.it> (permalink)
References <uuyCt-49t-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


After the loop in hns_roce_v1_mr_free_work_fn function, it is possible that
the local variable named hr_qp is NULL, the operation "hr_qp->qpn" will
result in the exception. As a result, we add return statement when checking
error.

This patch fixes the smatch error as below:
drivers/infiniband/hw/hns/hns_roce_hw_v1.c:1009 hns_roce_v1_mr_free_work_fn()
error: we previously assumed 'hr_qp' could be null

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Shaobo Xu <xushaobo2@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 3496f39..c08822b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -1004,6 +1004,11 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
 		}
 	}
 
+	if (!ne) {
+		dev_err(dev, "Reseved loop qp is absent!\n");
+		goto free_work;
+	}
+
 	do {
 		ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
 		if (ret < 0) {
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH for-next 0/9] Bug fixes & Code improvements in hip06 and hip08 RoCE driver "Wei Hu (Xavier)" <xavier.huwei@huawei.com> - 2017-09-28 06:40 +0200
  [PATCH for-next 7/9] RDMA/hns: Remove unnecessarily calling unregister_inetaddr_notifier function "Wei Hu (Xavier)" <xavier.huwei@huawei.com> - 2017-09-28 06:40 +0200
  [PATCH for-next 6/9] RDMA/hns: Add return statement when checking error in hns_roce_v1_mr_free_work_fn "Wei Hu (Xavier)" <xavier.huwei@huawei.com> - 2017-09-28 06:40 +0200
  [PATCH for-next 2/9] RDMA/hns: Factor out the code for checking sdb status into a new function "Wei Hu (Xavier)" <xavier.huwei@huawei.com> - 2017-09-28 06:40 +0200
    Re: [PATCH for-next 2/9] RDMA/hns: Factor out the code for checking  sdb status into a new function Leon Romanovsky <leon@kernel.org> - 2017-09-28 16:00 +0200
      Re: [PATCH for-next 2/9] RDMA/hns: Factor out the code for checking  sdb status into a new function "Wei Hu (Xavier)" <xavier.huwei@huawei.com> - 2017-09-29 04:10 +0200

csiph-web