From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: xiaolinkui <xiaolinkui@kylinos.cn>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch: s390: use struct_size() in kmalloc()
Date: Sat, 1 Jun 2019 12:21:04 +0200 [thread overview]
Message-ID: <20190601102104.GA3600@osiris> (raw)
In-Reply-To: <1558077317-12201-1-git-send-email-xiaolinkui@kylinos.cn>
On Fri, May 17, 2019 at 03:15:17PM +0800, xiaolinkui wrote:
> Use the new struct_size() helper to keep code simple.
>
> Signed-off-by: xiaolinkui <xiaolinkui@kylinos.cn>
> ---
> arch/s390/include/asm/idals.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h
> index 15578fd..6fb7ace 100644
> --- a/arch/s390/include/asm/idals.h
> +++ b/arch/s390/include/asm/idals.h
> @@ -122,8 +122,7 @@ idal_buffer_alloc(size_t size, int page_order)
>
> nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
> nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG;
> - ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *),
> - GFP_DMA | GFP_KERNEL);
> + ib = kmalloc(struct_size(ib, data, nr_ptrs), GFP_DMA | GFP_KERNEL);
> if (ib == NULL)
> return ERR_PTR(-ENOMEM);
> ib->size = size;
Applied, thanks.
prev parent reply other threads:[~2019-06-01 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 7:15 [PATCH] arch: s390: use struct_size() in kmalloc() xiaolinkui
2019-06-01 10:21 ` Heiko Carstens [this message]
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=20190601102104.GA3600@osiris \
--to=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=xiaolinkui@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox