Skip to contentSkip to conversation

soc/tegra: fuse: fix possible null-ptr-deref in tegra_fuse_probe()

PATCH RESEND New Yang Yingliang 1 participant 1 message Oct 29, 2022 Tegra architecture support

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 soc/tegra: fuse: fix possible null-ptr-deref in tegra_fuse_probe()

platform_get_resource() may return NULL pointer, we need check its return value to avoid null-ptr-deref while using it.

Fixes 55a042b3f68f ("soc/tegra: fuse: Fix reading registers using DMA on Tegra20")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/

---
 drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/fuse/fuse-tegra.c +1 -1
index 6542267a224d..bd2b00f2d617 100644
@@ -219,12 +219,12 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 
 	/* take over the memory region from the early initialization */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	fuse->phys = res->start;
 	fuse->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(fuse->base)) {
 		err = PTR_ERR(fuse->base);
 		return err;
 	}
+	fuse->phys = res->start;
 
 	fuse->clk = devm_clk_get(&pdev->dev, "fuse");
 	if (IS_ERR(fuse->clk)) {
Signature · 1 line
2.25.1