OSDN Git Service

RDMA/hns: Set allocated memory to zero for wrid
authorYixian Liu <liuyixian@huawei.com>
Sun, 3 Feb 2019 08:13:05 +0000 (16:13 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 14 Feb 2019 20:20:19 +0000 (13:20 -0700)
The memory allocated for wrid should be initialized to zero.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_qp.c

index 51ca22b..728ad8b 100644 (file)
@@ -763,10 +763,10 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
                        goto err_mtt;
                }
 
-               hr_qp->sq.wrid = kmalloc_array(hr_qp->sq.wqe_cnt, sizeof(u64),
-                                              GFP_KERNEL);
-               hr_qp->rq.wrid = kmalloc_array(hr_qp->rq.wqe_cnt, sizeof(u64),
-                                              GFP_KERNEL);
+               hr_qp->sq.wrid = kcalloc(hr_qp->sq.wqe_cnt, sizeof(u64),
+                                        GFP_KERNEL);
+               hr_qp->rq.wrid = kcalloc(hr_qp->rq.wqe_cnt, sizeof(u64),
+                                        GFP_KERNEL);
                if (!hr_qp->sq.wrid || !hr_qp->rq.wrid) {
                        ret = -ENOMEM;
                        goto err_wrid;