From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
Date: Thu, 24 Dec 2015 00:22:39 -0500 [thread overview]
Message-ID: <567B811F.2050006@redhat.com> (raw)
In-Reply-To: <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]
On 12/17/2015 02:31 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> Convert kmalloc to be kmalloc_array to fix warnings below:
>
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> + qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),
>
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> + qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),
>
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> + srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> drivers/infiniband/hw/mlx4/qp.c | 4 ++--
> drivers/infiniband/hw/mlx4/srq.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index dc86975fe1a9..70de13ed9da7 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -796,12 +796,12 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
> if (err)
> goto err_mtt;
>
> - qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),
> + qp->sq.wrid = kmalloc_array(qp->sq.wqe_cnt, sizeof(u64),
> gfp | __GFP_NOWARN);
> if (!qp->sq.wrid)
> qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64),
> gfp, PAGE_KERNEL);
> - qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),
> + qp->rq.wrid = kmalloc_array(qp->rq.wqe_cnt, sizeof(u64),
> gfp | __GFP_NOWARN);
> if (!qp->rq.wrid)
> qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
> diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
> index f416c7463827..68d5a5fda271 100644
> --- a/drivers/infiniband/hw/mlx4/srq.c
> +++ b/drivers/infiniband/hw/mlx4/srq.c
> @@ -171,7 +171,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
> if (err)
> goto err_mtt;
>
> - srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
> + srq->wrid = kmalloc_array(srq->msrq.max, sizeof(u64),
> GFP_KERNEL | __GFP_NOWARN);
> if (!srq->wrid) {
> srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64),
>
Applied with some edits to the commit message, thanks.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
next prev parent reply other threads:[~2015-12-24 5:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 7:31 [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Leon Romanovsky
[not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2015-12-17 7:31 ` [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings Leon Romanovsky
[not found] ` <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2015-12-17 8:44 ` Sagi Grimberg
2015-12-24 5:22 ` Doug Ledford [this message]
2015-12-17 8:44 ` [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Sagi Grimberg
2015-12-24 5:22 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=567B811F.2050006@redhat.com \
--to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=leon-2ukJVAZIZ/Y@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.