]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/hns: Check return value of kzalloc
authorWei Hu(Xavier) <xavier.huwei@huawei.com>
Fri, 29 Sep 2017 15:10:09 +0000 (23:10 +0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 29 Sep 2017 16:04:45 +0000 (12:04 -0400)
commitb79613c6cf46fd8e3e21f26a59cc83882a8cf100
tree7448cf0db29a1d165a887522ba74ee2c60b44ad9
parent36dbea3b7eaef6e39358ea9e3ee1d0e31736eba8
RDMA/hns: Check return value of kzalloc

When lp_qp_work is NULL, we should return ENOMEM.  In order to do so,
we had to make some upper layer functions return a value instead
of being void type so we can propagate the error up the stack.

This patch fixes the smatch error as below:
drivers/infiniband/hw/hns/hns_roce_hw_v1.c:918 hns_roce_v1_recreate_lp_qp()
error: potential null dereference 'lp_qp_work'.  (kzalloc returns 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_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_main.c