[PATCH] xhci: host: potential NULL dereference in xhci_generic_plat_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux