Skip to content

Commit e20d136

Browse files
Zheng Yongjundlezcano
authored andcommitted
thermal/drivers/broadcom: Fix potential NULL dereference in sr_thermal_probe
platform_get_resource() may return NULL, add proper check to avoid potential NULL dereferencing. Fixes: 250e211 ("thermal: broadcom: Add Stingray thermal driver") Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Link: https://lore.kernel.org/r/20220425092929.90412-1-zhengyongjun3@huawei.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 077df62 commit e20d136

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/thermal/broadcom/sr-thermal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ static int sr_thermal_probe(struct platform_device *pdev)
6060
return -ENOMEM;
6161

6262
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
63+
if (!res)
64+
return -ENOENT;
65+
6366
sr_thermal->regs = (void __iomem *)devm_memremap(&pdev->dev, res->start,
6467
resource_size(res),
6568
MEMREMAP_WB);

0 commit comments

Comments
 (0)