From: Dan Carpenter <error27@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] xhci: host: potential NULL dereference in xhci_generic_plat_probe()
Date: Thu, 9 Feb 2023 16:43:45 +0300 [thread overview]
Message-ID: <Y+T4kTcJwRwxNHJq@kili> (raw)
It's possible to exit the loop with "sysdev" set to NULL. In that
case we should use "&pdev->dev".
Fixes: ec5499d338ec ("xhci: split out rcar/rz support from xhci-plat.c")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
drivers/usb/host/xhci-plat.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index cd17ccab6e00..b9f9625467d6 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -368,6 +368,9 @@ static int xhci_generic_plat_probe(struct platform_device *pdev)
#endif
}
+ if (!sysdev)
+ sysdev = &pdev->dev;
+
if (WARN_ON(!sysdev->dma_mask)) {
/* Platform did not initialize dma_mask */
ret = dma_coerce_mask_and_coherent(sysdev, DMA_BIT_MASK(64));
--
2.35.1
next reply other threads:[~2023-02-09 13:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 13:43 Dan Carpenter [this message]
2023-02-10 16:45 ` [PATCH] xhci: host: potential NULL dereference in xhci_generic_plat_probe() Arnd Bergmann
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=Y+T4kTcJwRwxNHJq@kili \
--to=error27@gmail.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox