]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/hns: Avoid NULL pointer exception
authorWei Hu(Xavier) <xavier.huwei@huawei.com>
Fri, 29 Sep 2017 15:10:12 +0000 (23:10 +0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 29 Sep 2017 16:10:09 +0000 (12:10 -0400)
commit6f4249e9dc9982477646c1232336ef7b4de6d92f
tree4886293d582042476f50081bf124cc066ba816aa
parent970a192278d3c2932ceb7d6a9405abfc052678c9
RDMA/hns: Avoid NULL pointer exception

After the loop in hns_roce_v1_mr_free_work_fn function, it is possible that
all qps will have been freed (in which case ne will be 0).  If that
happens, then later in the function when we dereference hr_qp we will
get an exception.  Check ne is not 0 to make sure we actually have an
hr_qp left to work on.

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>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hns/hns_roce_hw_v1.c