All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] soc/tegra: fuse: fix possible null-ptr-deref in tegra_fuse_probe()
@ 2022-10-29 11:31 Yang Yingliang
  0 siblings, 0 replies; only message in thread
From: Yang Yingliang @ 2022-10-29 11:31 UTC (permalink / raw)
  To: linux-tegra; +Cc: thierry.reding, jonathanh, digetx, yangyingliang

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")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
The previous patch link:
https://lore.kernel.org/lkml/20220505093720.1283942-1-yangyingliang@huawei.com/
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 6542267a224d..bd2b00f2d617 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -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)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-29 11:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 11:31 [PATCH RESEND] soc/tegra: fuse: fix possible null-ptr-deref in tegra_fuse_probe() Yang Yingliang

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.