linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [bug report] device-dax: add dis-contiguous resource support
@ 2020-08-31 11:32 Dan Carpenter
  2020-08-31 19:03 ` Joao Martins
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-08-31 11:32 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm

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			},

regards,
dan carpenter
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] device-dax: add dis-contiguous resource support
  2020-08-31 11:32 [bug report] device-dax: add dis-contiguous resource support Dan Carpenter
@ 2020-08-31 19:03 ` Joao Martins
  0 siblings, 0 replies; 2+ messages in thread
From: Joao Martins @ 2020-08-31 19:03 UTC (permalink / raw)
  To: Dan Carpenter, dan.j.williams; +Cc: linux-nvdimm

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 -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-31 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 11:32 [bug report] device-dax: add dis-contiguous resource support Dan Carpenter
2020-08-31 19:03 ` Joao Martins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).