[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAA5qM4C05nKGC0=FK2CntcX8SodotypVvCeAkMeVekX65o4+0A@mail.gmail.com>
Date: Wed, 19 May 2021 13:20:24 -0700
From: Tong Zhang <ztong0001@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] misc: alcor_pci: fix null-ptr-deref when there is no
PCI bridge
On Wed, May 19, 2021 at 1:40 AM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> Hello Tong Zhang,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 3ce3e45cc333: "misc: alcor_pci: fix null-ptr-deref when
> there is no PCI bridge" from May 13, 2021, leads to the following
> Smatch complaint:
>
> drivers/misc/cardreader/alcor_pci.c:149 alcor_pci_init_check_aspm()
> error: we previously assumed 'priv->parent_pdev' could be null (see line 147)
>
> drivers/misc/cardreader/alcor_pci.c
> 142 /*
> 143 * A device might be attached to root complex directly and
> 144 * priv->parent_pdev will be NULL. In this case we don't check its
> 145 * capability and disable ASPM completely.
> 146 */
> 147 if (!priv->parent_pdev)
> ^^^^^^^^^^^^^^^^^^
>
> 148 priv->parent_cap_off = alcor_pci_find_cap_offset(priv,
> 149 priv->parent_pdev);
> ^^^^^^^^^^^^^^^^^^
> It will just crash inside the function call. Is the if statement
> reversed?
>
> 150
> 151 if ((priv->pdev_cap_off == 0) || (priv->parent_cap_off == 0)) {
>
> regards,
> dan carpenter
Thanks Dan.
I already corrected this in v4
https://lkml.org/lkml/2021/5/18/1040
Please check if the issue persists.
- Tong
Powered by blists - more mailing lists