[PATCH 20/20] hwmon: (w83781d) check return value after calling platform_get_resource()

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

 



It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Fixes: 7666c13c627f ("hwmon/w83781d: No longer use i2c-isa")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
 drivers/hwmon/w83781d.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index b3579721265f..4fe6eec02570 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1767,6 +1767,8 @@ w83781d_isa_probe(struct platform_device *pdev)
 
 	/* Reserve the ISA region */
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (!res)
+		return -EINVAL;
 	if (!devm_request_region(&pdev->dev,
 				 res->start + W83781D_ADDR_REG_OFFSET, 2,
 				 "w83781d"))
-- 
2.25.1




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux