From: Eric Farman <farman@linux.ibm.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Vineeth Vijayan <vneethv@linux.ibm.com>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH 2/2][next] vfio/ccw: Use struct_size() helper
Date: Tue, 23 May 2023 12:33:58 -0400 [thread overview]
Message-ID: <46a965e53acef4497d2f0da24267f484daf29e1c.camel@linux.ibm.com> (raw)
In-Reply-To: <f657276073630e806e69726a40ad1cc85101448a.1684805398.git.gustavoars@kernel.org>
On Mon, 2023-05-22 at 19:35 -0600, Gustavo A. R. Silva wrote:
> Prefer struct_size() over open-coded versions.
>
> Link: https://github.com/KSPP/linux/issues/160
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/s390/cio/vfio_ccw_drv.c
> b/drivers/s390/cio/vfio_ccw_drv.c
> index 57906a9c6324..43601816ea4e 100644
> --- a/drivers/s390/cio/vfio_ccw_drv.c
> +++ b/drivers/s390/cio/vfio_ccw_drv.c
> @@ -171,8 +171,7 @@ static int vfio_ccw_sch_probe(struct subchannel
> *sch)
> return -ENODEV;
> }
>
> - parent = kzalloc(sizeof(*parent) + sizeof(struct mdev_type
> *),
> - GFP_KERNEL);
> + parent = kzalloc(struct_size(parent, mdev_types, 1),
> GFP_KERNEL);
> if (!parent)
> return -ENOMEM;
>
next prev parent reply other threads:[~2023-05-23 16:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 1:34 [PATCH 0/2][next] vfio/ccw: Replace one-element array with flexible-array member Gustavo A. R. Silva
2023-05-23 1:35 ` [PATCH 1/2][next] " Gustavo A. R. Silva
2023-05-23 16:33 ` Eric Farman
2023-05-23 17:29 ` Kees Cook
2023-05-23 17:45 ` Christophe JAILLET
2023-05-23 17:47 ` Marion & Christophe JAILLET
2023-05-23 1:35 ` [PATCH 2/2][next] vfio/ccw: Use struct_size() helper Gustavo A. R. Silva
2023-05-23 16:33 ` Eric Farman [this message]
2023-05-23 17:30 ` Kees Cook
2023-05-23 16:36 ` [PATCH 0/2][next] vfio/ccw: Replace one-element array with flexible-array member Matthew Rosato
2023-05-23 18:58 ` Alexander Gordeev
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=46a965e53acef4497d2f0da24267f484daf29e1c.camel@linux.ibm.com \
--to=farman@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gustavoars@kernel.org \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=oberpar@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=vneethv@linux.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).