]> git.samba.org - sfrench/cifs-2.6.git/commitdiff
RDMA: Clear CTX objects during their allocation
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 9 Jan 2019 18:16:01 +0000 (20:16 +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 CTX objects is cleared before access.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_main.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
drivers/infiniband/sw/rdmavt/vt.c

index c79054ba94958a4b43d8aa2c0d2322af977a7030..44a07fce0617743bea0efe03ec08b768fb3f5870 100644 (file)
@@ -343,7 +343,7 @@ static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev,
 
        resp.qp_tab_size = hr_dev->caps.num_qps;
 
-       context = kmalloc(sizeof(*context), GFP_KERNEL);
+       context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context)
                return ERR_PTR(-ENOMEM);
 
index 1fcc007d1d34ca3cd373843e7f51c33f160aee5b..0a939ea5497b6d7143a2e11c16036fdfaea2ace1 100644 (file)
@@ -318,7 +318,7 @@ static struct ib_ucontext *mthca_alloc_ucontext(struct ib_device *ibdev,
        else
                uresp.uarc_size = 0;
 
-       context = kmalloc(sizeof *context, GFP_KERNEL);
+       context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context)
                return ERR_PTR(-ENOMEM);
 
index 63c7b48774e9b7c323f2245e7084d3f967aa5406..432e6f6599fa54e6ce4997d881c33325b6904cae 100644 (file)
@@ -683,7 +683,7 @@ struct ib_ucontext *usnic_ib_alloc_ucontext(struct ib_device *ibdev,
        struct usnic_ib_dev *us_ibdev = to_usdev(ibdev);
        usnic_dbg("\n");
 
-       context = kmalloc(sizeof(*context), GFP_KERNEL);
+       context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context)
                return ERR_PTR(-ENOMEM);
 
index 65b6115caa550dd72553c15c642a26b0ca9a36b7..e10149248ce262efe11dcfb06a4fc38a1b972f5c 100644 (file)
@@ -327,7 +327,7 @@ struct ib_ucontext *pvrdma_alloc_ucontext(struct ib_device *ibdev,
        if (!vdev->ib_active)
                return ERR_PTR(-EAGAIN);
 
-       context = kmalloc(sizeof(*context), GFP_KERNEL);
+       context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context)
                return ERR_PTR(-ENOMEM);
 
index aef3aa3fe6672ce9d6c84600e466c3cf00d40afd..8724a18171584c56b2007b0f0eb19c431452c1dd 100644 (file)
@@ -304,7 +304,7 @@ static struct ib_ucontext *rvt_alloc_ucontext(struct ib_device *ibdev,
 {
        struct rvt_ucontext *context;
 
-       context = kmalloc(sizeof(*context), GFP_KERNEL);
+       context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context)
                return ERR_PTR(-ENOMEM);
        return &context->ibucontext;