All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Jackie Liu <liuyun01@kylinos.cn>, "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] block/bio-integrity: use struct_size() in kmalloc()
Date: Wed, 15 May 2019 15:50:21 +0000	[thread overview]
Message-ID: <SN6PR04MB4527E5E4327E1C87CA4C704C86090@SN6PR04MB4527.namprd04.prod.outlook.com> (raw)
In-Reply-To: 1557910339-2140-1-git-send-email-liuyun01@kylinos.cn

Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

On 05/15/2019 02:04 AM, Jackie Liu wrote:
> Use the new struct_size() helper to keep code simple.
>
> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
> ---
>   block/bio-integrity.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index 1b633a3526d4..5152009b5b59 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -57,8 +57,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
>   	unsigned inline_vecs;
>
>   	if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) {
> -		bip = kmalloc(sizeof(struct bio_integrity_payload) +
> -			      sizeof(struct bio_vec) * nr_vecs, gfp_mask);
> +		bip = kmalloc(struct_size(bip, bip_inline_vecs, nr_vecs), gfp_mask);
>   		inline_vecs = nr_vecs;
>   	} else {
>   		bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask);
>


  reply	other threads:[~2019-05-15 15:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15  8:52 [PATCH] block/bio-integrity: use struct_size() in kmalloc() Jackie Liu
2019-05-15 15:50 ` Chaitanya Kulkarni [this message]
2019-05-16 14:49 ` Jens Axboe

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=SN6PR04MB4527E5E4327E1C87CA4C704C86090@SN6PR04MB4527.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=liuyun01@kylinos.cn \
    /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.