All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ztong0001@gmail.com
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	open list <linux-kernel@vger.kernel.org>
Subject: re: [PATCH v3] misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge
Date: Wed, 19 May 2021 11:40:27 +0300	[thread overview]
Message-ID: <YKTO+xuM/Ly+8Vwf@mwanda> (raw)
In-Reply-To: <20210513040732.1310159-1-ztong0001@gmail.com>

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

  reply	other threads:[~2021-05-19  8:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 22:07 [PATCH] misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge Tong Zhang
2021-05-10 14:36 ` Greg Kroah-Hartman
2021-05-10 22:20   ` Tong Zhang
2021-05-11  7:03     ` Greg Kroah-Hartman
2021-05-11 17:17       ` Tong Zhang
2021-05-11 17:57         ` Greg Kroah-Hartman
2021-05-11 21:29           ` [PATCH v2] " Tong Zhang
2021-05-12  6:24             ` Greg Kroah-Hartman
2021-05-12 16:24               ` Tong Zhang
2021-05-12 16:41                 ` Greg Kroah-Hartman
2021-05-13  4:07                   ` [PATCH v3] " Tong Zhang
2021-05-19  8:40                     ` Dan Carpenter [this message]
2021-05-19 20:20                       ` Tong Zhang
2021-05-13  4:09                   ` [PATCH v2] " Tong Zhang
2021-05-11 21:32           ` [PATCH] " Tong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKTO+xuM/Ly+8Vwf@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ztong0001@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.