On Tue, Jun 30, 2015 at 10:29 AM, Dan Carpenter
<dan.carpenter(a)oracle.com> wrote:
Hello Dan Williams,
This is a semi-automatic email about new static checker warnings.
The patch 8c2f7e8658df: "libnvdimm: infrastructure for btt devices"
from Jun 25, 2015, leads to the following Smatch complaint:
drivers/nvdimm/region_devs.c:461 nd_region_notify_driver_action()
error: we previously assumed 'dev->parent' could be null (see line
453)
drivers/nvdimm/region_devs.c
452 }
453 if (dev->parent && is_nd_blk(dev->parent) && probe)
{
^^^^^^^^^^^
New check.
454 nd_region = to_nd_region(dev->parent);
455 nvdimm_bus_lock(dev);
456 if (nd_region->ns_seed == dev)
457 nd_region_create_blk_seed(nd_region);
458 nvdimm_bus_unlock(dev);
459 }
460 if (is_nd_btt(dev) && probe) {
461 nd_region = to_nd_region(dev->parent);
^^^^^^^^^^^
New unchecked dereference inside function call.
I think this is a tricky false positive. is_nd_btt() implies that
dev->parent is valid, whereas the former is_nd_blk() check can't be
done until we know dev->parent is valid.