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