[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ZDmKKadGjEwKMCcY@smile.fi.intel.com>
Date: Fri, 14 Apr 2023 20:15:21 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: kernel-janitors@...r.kernel.org, nvdimm@...ts.linux.dev,
Dan Williams <dan.j.williams@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Vishal Verma <vishal.l.verma@...el.com>, cocci@...ia.fr,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nvdimm: Replace the usage of a variable by a direct
function call in nd_pfn_validate()
On Fri, Apr 14, 2023 at 12:12:37PM +0200, Markus Elfring wrote:
> Date: Fri, 14 Apr 2023 12:01:15 +0200
>
> The address of a data structure member was determined before
> a corresponding null pointer check in the implementation of
> the function “nd_pfn_validate”.
>
> Thus avoid the risk for undefined behaviour by replacing the usage of
> the local variable “parent_uuid” by a direct function call within
> a later condition check.
> This issue was detected by using the Coccinelle software.
>
> Fixes: d1c6e08e7503649e4a4f3f9e700e2c05300b6379 ("libnvdimm/labels: Add uuid helpers")
Same issues as per patch 1.
...
> - if (memcmp(pfn_sb->parent_uuid, parent_uuid, 16) != 0)
> + if (memcmp(pfn_sb->parent_uuid, nd_dev_to_uuid(&ndns->dev), 16) != 0)
If parent_uuid is of uuid_t type, you better to replace memcmp() with
uuid_equal().
> return -ENODEV;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists