From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
"Jiang, Dave" <dave.jiang@intel.com>,
"gustavo@embeddedor.com" <gustavo@embeddedor.com>,
"Busch, Keith" <keith.busch@intel.com>,
"Weiny, Ira" <ira.weiny@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH] libnvdimm, region: Use struct_size() in kzalloc()
Date: Wed, 28 Aug 2019 20:24:35 +0000 [thread overview]
Message-ID: <7980d0c0b43bc6f377e0daad4a066f7ab37c2258.camel@intel.com> (raw)
In-Reply-To: <d940183a-c00d-3a96-37bb-9553583f160a@embeddedor.com>
On Wed, 2019-08-28 at 14:36 -0500, Gustavo A. R. Silva wrote:
> struct_size() does not apply to those scenarios. See below...
>
> > [1]:
> > https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/tree/drivers/nvdimm/region_devs.c#n1030
>
> struct_size() only applies to structures of the following kind:
>
> struct foo {
> int stuff;
> struct boo entry[];
> };
>
> and this scenario includes two different structures:
>
> struct nd_region {
> ...
> struct nd_mapping mapping[0];
> };
>
> struct nd_blk_region {
> ...
> struct nd_region nd_region;
> };
Yep - I neglected to actually look at the structures involved - you're
right, it doesn't apply here.
>
> > [2]:
> > https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/tree/drivers/nvdimm/region_devs.c#n96
> >
>
> In this scenario struct_size() does not apply directly because of the
> following
> logic before the call to devm_kzalloc():
Agreed, I missed that the calculation was more involved here.
Thanks for the clarifications, you can add:
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2019-08-28 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 21:06 [PATCH] libnvdimm, region: Use struct_size() in kzalloc() Gustavo A. R. Silva
2019-08-28 18:30 ` Gustavo A. R. Silva
2019-08-28 20:25 ` Kees Cook
2019-08-28 18:51 ` Verma, Vishal L
2019-08-28 19:36 ` Gustavo A. R. Silva
2019-08-28 20:24 ` Verma, Vishal L [this message]
2019-08-29 21:04 ` Dan Williams
-- strict thread matches above, loose matches on Subject: below --
2019-02-21 15:23 [PATCH] libnvdimm, region: use " Gustavo A. R. Silva
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=7980d0c0b43bc6f377e0daad4a066f7ab37c2258.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=gustavo@embeddedor.com \
--cc=ira.weiny@intel.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.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 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).