[PATCH 12/20] hwmon: (sis5595) 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: 17e7dc4373df ("hwmon/sis5595: Convert to a platform driver")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
 drivers/hwmon/sis5595.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 018cb5a7651f..b664c306d087 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -579,6 +579,8 @@ static int sis5595_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, SIS5595_EXTENT,
 				 sis5595_driver.driver.name))
 		return -EBUSY;
-- 
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