Re: [PATCH v2] PCI: dwc: keystone: Fix potential NULL dereference

From: Bjorn Helgaas
Date: Fri Apr 26 2024 - 18:47:56 EST


On Thu, Apr 25, 2024 at 03:00:14PM +0200, Alexander Lobakin wrote:
> From: Aleksandr Mishin <amishin@xxxxxxxxxx>
> Date: Thu, 25 Apr 2024 12:21:35 +0300
>
> > In ks_pcie_setup_rc_app_regs() resource_list_first_type() may return
> > NULL which is later dereferenced. Fix this bug by adding NULL check.
> >
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Please stop spamming with "potential fixes" made mechanically from
> static analyzer reports without looking into the code flow. These
> patches are mostly incorrect and may hurt.
> Either have a stable repro and then fix the real bug or don't touch
> anything at all.

Did you look at the actual patch? I'm not a keystone expert, but this
patch looks reasonable to me.

It might still be the case that we're guaranteed to have an
IORESOURCE_MEM window by other code, but it looks like a real hassle
to prove that.

> > Fixes: 0f71c60ffd26 ("PCI: dwc: Remove storing of PCI resources")
> > Signed-off-by: Aleksandr Mishin <amishin@xxxxxxxxxx>
>
> Thanks,
> Olek