Re: [PATCH v8 0/7] Add pci_dev_for_each_resource() helper and update users

From: Bjorn Helgaas
Date: Tue May 30 2023 - 17:24:11 EST


On Fri, May 12, 2023 at 02:48:51PM -0500, Bjorn Helgaas wrote:
> On Fri, May 12, 2023 at 01:56:29PM +0300, Andy Shevchenko wrote:
> > On Tue, May 09, 2023 at 01:21:22PM -0500, Bjorn Helgaas wrote:
> > > On Tue, Apr 04, 2023 at 11:11:01AM -0500, Bjorn Helgaas wrote:
> > > > On Thu, Mar 30, 2023 at 07:24:27PM +0300, Andy Shevchenko wrote:
> > > > > Provide two new helper macros to iterate over PCI device resources and
> > > > > convert users.
> > >
> > > > Applied 2-7 to pci/resource for v6.4, thanks, I really like this!
> > >
> > > This is 09cc90063240 ("PCI: Introduce pci_dev_for_each_resource()")
> > > upstream now.
> > >
> > > Coverity complains about each use,
> >
> > It needs more clarification here. Use of reduced variant of the
> > macro or all of them? If the former one, then I can speculate that
> > Coverity (famous for false positives) simply doesn't understand `for
> > (type var; var ...)` code.
>
> True, Coverity finds false positives. It flagged every use in
> drivers/pci and drivers/pnp. It didn't mention the arch/alpha, arm,
> mips, powerpc, sh, or sparc uses, but I think it just didn't look at
> those.
>
> It flagged both:
>
> pbus_size_io pci_dev_for_each_resource(dev, r)
> pbus_size_mem pci_dev_for_each_resource(dev, r, i)
>
> Here's a spreadsheet with a few more details (unfortunately I don't
> know how to make it dump the actual line numbers or analysis like I
> pasted below, so "pci_dev_for_each_resource" doesn't appear). These
> are mostly in the "Drivers-PCI" component.
>
> https://docs.google.com/spreadsheets/d/1ohOJwxqXXoDUA0gwopgk-z-6ArLvhN7AZn4mIlDkHhQ/edit?usp=sharing
>
> These particular reports are in the "High Impact Outstanding" tab.

Where are we at? Are we going to ignore this because some Coverity
reports are false positives?

Bjorn