All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: broadcom: Fix potential NULL dereference in sr_thermal_probe
@ 2022-04-25  9:29 Zheng Yongjun
  2022-04-25 18:25 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/broadcom: " thermal-bot for Zheng Yongjun
  0 siblings, 2 replies; 3+ messages in thread
From: Zheng Yongjun @ 2022-04-25  9:29 UTC (permalink / raw)
  To: linux-pm, linux-kernel; +Cc: rafael, daniel.lezcano, amitk, rui.zhang

platform_get_resource() may return NULL, add proper check to
avoid potential NULL dereferencing.

Fixes: 250e211057c72 ("thermal: broadcom: Add Stingray thermal driver")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/thermal/broadcom/sr-thermal.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c
index 475ce2900771..85ab9edd580c 100644
--- a/drivers/thermal/broadcom/sr-thermal.c
+++ b/drivers/thermal/broadcom/sr-thermal.c
@@ -60,6 +60,9 @@ static int sr_thermal_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENOENT;
+
 	sr_thermal->regs = (void __iomem *)devm_memremap(&pdev->dev, res->start,
 							 resource_size(res),
 							 MEMREMAP_WB);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: broadcom: Fix potential NULL dereference in sr_thermal_probe
  2022-04-25  9:29 [PATCH] thermal: broadcom: Fix potential NULL dereference in sr_thermal_probe Zheng Yongjun
@ 2022-04-25 18:25 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/broadcom: " thermal-bot for Zheng Yongjun
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2022-04-25 18:25 UTC (permalink / raw)
  To: Zheng Yongjun, linux-pm, linux-kernel; +Cc: rafael, amitk, rui.zhang

On 25/04/2022 11:29, Zheng Yongjun wrote:
> platform_get_resource() may return NULL, add proper check to
> avoid potential NULL dereferencing.
> 
> Fixes: 250e211057c72 ("thermal: broadcom: Add Stingray thermal driver")
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---

Applied, thanks

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [thermal: thermal/next] thermal/drivers/broadcom: Fix potential NULL dereference in sr_thermal_probe
  2022-04-25  9:29 [PATCH] thermal: broadcom: Fix potential NULL dereference in sr_thermal_probe Zheng Yongjun
  2022-04-25 18:25 ` Daniel Lezcano
@ 2022-05-19 12:44 ` thermal-bot for Zheng Yongjun
  1 sibling, 0 replies; 3+ messages in thread
From: thermal-bot for Zheng Yongjun @ 2022-05-19 12:44 UTC (permalink / raw)
  To: linux-pm; +Cc: Zheng Yongjun, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     e20d136ec7d6f309989c447638365840d3424c8e
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//e20d136ec7d6f309989c447638365840d3424c8e
Author:        Zheng Yongjun <zhengyongjun3@huawei.com>
AuthorDate:    Mon, 25 Apr 2022 09:29:29 
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:52 +02:00

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: 250e211057c72 ("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>
---
 drivers/thermal/broadcom/sr-thermal.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c
index 475ce29..85ab9ed 100644
--- a/drivers/thermal/broadcom/sr-thermal.c
+++ b/drivers/thermal/broadcom/sr-thermal.c
@@ -60,6 +60,9 @@ static int sr_thermal_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENOENT;
+
 	sr_thermal->regs = (void __iomem *)devm_memremap(&pdev->dev, res->start,
 							 resource_size(res),
 							 MEMREMAP_WB);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-19 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  9:29 [PATCH] thermal: broadcom: Fix potential NULL dereference in sr_thermal_probe Zheng Yongjun
2022-04-25 18:25 ` Daniel Lezcano
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/broadcom: " thermal-bot for Zheng Yongjun

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.