On 8/31/20 12:32 PM, Dan Carpenter wrote:
> Hello Dan Williams,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 454c727769f5: "device-dax: add dis-contiguous resource
> support" from Aug 26, 2020, leads to the following Smatch complaint:
> 
>     drivers/dax/bus.c:788 alloc_dev_dax_range()
>     error: we previously assumed 'alloc' could be null (see line 772)
> 
> drivers/dax/bus.c
>    771                alloc = __request_region(res, start, size, 
> dev_name(dev), 0);
>    772                if (!alloc && !dev_dax->nr_range) {
>                            ^^
> This should probably be a ||?
> 
>    773                        /*
>    774                         * If we adjusted an existing @ranges leave it 
> alone,
>    775                         * but if this was an empty set of ranges 
> nothing else
>    776                         * will release @ranges, so do it now.
>    777                         */
>    778                        kfree(ranges);
>    779                        return -ENOMEM;
>    780                }
>    781        
>    782                for (i = 0; i < dev_dax->nr_range; i++)
>    783                        pgoff += PHYS_PFN(range_len(&ranges[i].range));
>    784                dev_dax->ranges = ranges;
>    785                ranges[dev_dax->nr_range++] = (struct dev_dax_range) {
>    786                        .pgoff = pgoff,
>    787                        .range = {
>    788                                .start = alloc->start,
>                                          ^^^^^^^^^^^^
> Dereferences.
> 
>    789                                .end = alloc->end,
>    790                        },
> 
This is already fixed in mmots:

https://www.ozlabs.org/~akpm/mmots/broken-out/device-dax-add-dis-contiguous-resource-support-fix.patch
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to