]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA: Clear CQ objects during their allocation
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 9 Jan 2019 18:15:59 +0000 (20:15 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 11 Jan 2019 00:08:52 +0000 (17:08 -0700)
As part of an audit process to update drivers to use rdma_restrack_add()
ensure that CQ objects is cleared before access.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/hw/mthca/mthca_provider.c

index db936c12b5bd5431dacead5a319d463363ec71cb..03ac72339dd28ce3fee5e73ff50941cbb4a54fd1 100644 (file)
@@ -190,7 +190,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev,
        if (attr->flags & ~CQ_CREATE_FLAGS_SUPPORTED)
                return ERR_PTR(-EINVAL);
 
-       cq = kmalloc(sizeof *cq, GFP_KERNEL);
+       cq = kzalloc(sizeof(*cq), GFP_KERNEL);
        if (!cq)
                return ERR_PTR(-ENOMEM);
 
index f87ee3058c6501fd8820deb3e5852e335856c8f2..1fcc007d1d34ca3cd373843e7f51c33f160aee5b 100644 (file)
@@ -684,7 +684,7 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev,
                        goto err_unmap_set;
        }
 
-       cq = kmalloc(sizeof *cq, GFP_KERNEL);
+       cq = kzalloc(sizeof(*cq), GFP_KERNEL);
        if (!cq) {
                err = -ENOMEM;
                goto err_unmap_arm;