All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tong Zhang <ztong0001@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tong Zhang <ztong0001@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: Colin Ian King <colin.king@canonical.com>
Subject: [PATCH v1] misc: alcor_pci: fix inverted branch condition
Date: Sat, 22 May 2021 00:37:25 -0400	[thread overview]
Message-ID: <20210522043725.602179-1-ztong0001@gmail.com> (raw)
In-Reply-To: <YKerHVMuqnRQmhMz@kroah.com>

This patch fixes a trivial mistake that I made in the previous attempt
in fixing the null bridge issue. The branch condition is inverted and we
should call alcor_pci_find_cap_offset() only if bridge is not null.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 3ce3e45cc333 ("misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge")
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
 drivers/misc/cardreader/alcor_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c
index 0a62307f7ffb..de6d44a158bb 100644
--- a/drivers/misc/cardreader/alcor_pci.c
+++ b/drivers/misc/cardreader/alcor_pci.c
@@ -144,7 +144,7 @@ static void alcor_pci_init_check_aspm(struct alcor_pci_priv *priv)
 	 * priv->parent_pdev will be NULL. In this case we don't check its
 	 * capability and disable ASPM completely.
 	 */
-	if (!priv->parent_pdev)
+	if (priv->parent_pdev)
 		priv->parent_cap_off = alcor_pci_find_cap_offset(priv,
 							 priv->parent_pdev);
 
-- 
2.25.1


  parent reply	other threads:[~2021-05-22  4:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 18:32 misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge Colin Ian King
2021-05-18 19:22 ` Tong Zhang
2021-05-18 19:28 ` [PATCH v4] " Tong Zhang
2021-05-21 12:44   ` Greg Kroah-Hartman
2021-05-21 14:51     ` Tong Zhang
2021-05-22  4:37     ` Tong Zhang [this message]
2021-05-22  4:40     ` 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=20210522043725.602179-1-ztong0001@gmail.com \
    --to=ztong0001@gmail.com \
    --cc=arnd@arndb.de \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.