> -----Original Message----- > From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma- > owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky > Sent: Monday, March 12, 2018 10:16 AM > To: Doug Ledford <dledford@xxxxxxxxxx>; Jason Gunthorpe > <jgg@xxxxxxxxxxxx> > Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>; RDMA mailing list <linux- > rdma@xxxxxxxxxxxxxxx>; Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx> > Subject: [PATCH rdma-next 13/15] RDMA/qib: Zero all allocated memory > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx> > > Replace general allocations to be zero based. > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/hw/qib/qib_diag.c | 8 ++++---- > drivers/infiniband/hw/qib/qib_file_ops.c | 4 ++-- > drivers/infiniband/hw/qib/qib_fs.c | 6 +++--- > drivers/infiniband/hw/qib/qib_iba6120.c | 4 ++-- > drivers/infiniband/hw/qib/qib_iba7220.c | 4 ++-- > drivers/infiniband/hw/qib/qib_iba7322.c | 12 ++++++------ > drivers/infiniband/hw/qib/qib_init.c | 8 ++++---- > drivers/infiniband/hw/qib/qib_user_sdma.c | 20 ++++++++++---------- > drivers/infiniband/hw/qib/qib_verbs.c | 2 +- > 9 files changed, 34 insertions(+), 34 deletions(-) > > diff --git a/drivers/infiniband/hw/qib/qib_diag.c > b/drivers/infiniband/hw/qib/qib_diag.c > index a9377eee8734..d8ff8d0580d2 100644 > --- a/drivers/infiniband/hw/qib/qib_diag.c > +++ b/drivers/infiniband/hw/qib/qib_diag.c > @@ -72,7 +72,7 @@ static struct qib_diag_client { > } *client_pool; > > /* > - * Get a client struct. Recycled if possible, else kmalloc. > + * Get a client struct. Recycled if possible, else kzalloc. > * Must be called with qib_mutex held > */ > static struct qib_diag_client *get_client(struct qib_devdata *dd) > @@ -85,7 +85,7 @@ static struct qib_diag_client *get_client(struct > qib_devdata *dd) > client_pool = dc->next; > else > /* None in pool, alloc and init */ > - dc = kmalloc(sizeof(*dc), GFP_KERNEL); > + dc = kzalloc(sizeof(*dc), GFP_KERNEL); > > if (dc) { > dc->next = NULL; > @@ -607,7 +607,7 @@ static ssize_t qib_diagpkt_write(struct file *fp, > > plen = sizeof(u32) + dp.len; > > - tmpbuf = vmalloc(plen); > + tmpbuf = vzalloc(plen); > if (!tmpbuf) { > ret = -ENOMEM; > goto bail; > @@ -699,7 +699,7 @@ int qib_register_observer(struct qib_devdata *dd, > > if (!dd || !op) > return -EINVAL; > - olp = vmalloc(sizeof(*olp)); > + olp = vzalloc(sizeof(*olp)); > if (!olp) > return -ENOMEM; > > diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c > b/drivers/infiniband/hw/qib/qib_file_ops.c > index 52c29db3a2f4..e9bc6c036cf0 100644 > --- a/drivers/infiniband/hw/qib/qib_file_ops.c > +++ b/drivers/infiniband/hw/qib/qib_file_ops.c > @@ -1300,7 +1300,7 @@ static int setup_ctxt(struct qib_pportdata *ppd, int > ctxt, > * reduce cost of expected send setup per message segment > */ > if (rcd) > - ptmp = kmalloc(dd->rcvtidcnt * sizeof(u16) + > + ptmp = kzalloc(dd->rcvtidcnt * sizeof(u16) + > dd->rcvtidcnt * sizeof(struct page **), > GFP_KERNEL); > > @@ -2245,7 +2245,7 @@ static ssize_t qib_write_iter(struct kiocb *iocb, > struct iov_iter *from) > > if (!iter_is_iovec(from) || !from->nr_segs || !pq) > return -EINVAL; > - > + Is there a reason for adding this extra line? > return qib_user_sdma_writev(rcd, pq, from->iov, from->nr_segs); > } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html