linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: "Verma, Vishal L" <vishal.l.verma@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"gustavo@embeddedor.com" <gustavo@embeddedor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] libnvdimm, region: Use struct_size() in kzalloc()
Date: Thu, 29 Aug 2019 14:04:49 -0700	[thread overview]
Message-ID: <CAPcyv4jEgk3Nsax0_KxDEsOPY91_py5NTyh2F58zVcoxaO0_Tw@mail.gmail.com> (raw)
In-Reply-To: <7980d0c0b43bc6f377e0daad4a066f7ab37c2258.camel@intel.com>

On Wed, Aug 28, 2019 at 1:24 PM Verma, Vishal L
<vishal.l.verma@intel.com> wrote:
>
> 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>

Thanks, applied.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2019-08-29 21:06 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
2019-08-29 21:04       ` Dan Williams [this message]
  -- 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=CAPcyv4jEgk3Nsax0_KxDEsOPY91_py5NTyh2F58zVcoxaO0_Tw@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@intel.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).