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


Groups > linux.kernel > #1742165 > unrolled thread

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

Started by"Wei Hu (Xavier)" <xavier.huwei@huawei.com>
First post2017-09-29 16:50 +0200
Last post2017-09-29 16:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V2 for-next 6/8] 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-29 16:50 +0200

#1742165 — [PATCH V2 for-next 6/8] RDMA/hns: Add return statement when checking error in hns_roce_v1_mr_free_work_fn

From"Wei Hu (Xavier)" <xavier.huwei@huawei.com>
Date2017-09-29 16:50 +0200
Subject[PATCH V2 for-next 6/8] RDMA/hns: Add return statement when checking error in hns_roce_v1_mr_free_work_fn
Message-ID<uv4M2-7tm-21@gated-at.bofh.it>
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 d82b4de..15e0f2e 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web