[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKTO+xuM/Ly+8Vwf@mwanda>
Date: Wed, 19 May 2021 11:40:27 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: ztong0001@...il.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
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
Powered by blists - more mailing lists