Re: [PATCH v1 1/1] ACPI: NFIT: Import GUID before use

Andy Shevchenko <[email protected]> Fri, 16 Apr 2021 20:33:55 +0300
Newsgroups org.01.lists.linux-nvdimm,dev.linux.lists.nvdimm,org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
Message-ID <[email protected]>
On Fri, Apr 16, 2021 at 09:15:34AM -0700, Dan Williams wrote:
> On Fri, Apr 16, 2021 at 1:58 AM Andy Shevchenko
> <[email protected]> wrote:
> > On Fri, Apr 16, 2021 at 8:28 AM Dan Williams <[email protected]> wrote:
> > > On Thu, Apr 15, 2021 at 6:59 AM Andy Shevchenko
> > > <[email protected]> wrote:
> > > >
> > > > Strictly speaking the comparison between guid_t and raw buffer
> > > > is not correct. Import GUID to variable of guid_t type and then
> > > > compare.
> > >
> > > Hmm, what about something like the following instead, because it adds
> > > safety. Any concerns about evaluating x twice in a macro should be
> > > alleviated by the fact that ARRAY_SIZE() will fail the build if (x) is
> > > not an array.
> >
> > ARRAY_SIZE doesn't check type.
> 
> See __must_be_array.
> 
> > I don't like hiding ugly casts like this.
> 
> See PTR_ERR, ERR_PTR, ERR_CAST.

It's special, i.e. error pointer case. We don't handle such here.

> There's nothing broken about the way the code currently stands, so I'd
> rather try to find something to move the implementation forward than
> sideways.

Submit a patch then. I rest my case b/c I consider that ugly castings worse
than additional API call, although it's not ideal.

-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]