[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220422091207.4034406-20-yangyingliang@huawei.com>
Date: Fri, 22 Apr 2022 17:12:06 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <linux-hwmon@...r.kernel.org>
CC: <linux@...ck-us.net>, <jdelvare@...e.com>
Subject: [PATCH 19/20] hwmon: (w83627hf) check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Fixes: 787c72b10788 ("hwmon/w83627hf: Convert to a platform driver")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/hwmon/w83627hf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 9be277156ed2..9d370d73d39d 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1407,6 +1407,8 @@ static int w83627hf_probe(struct platform_device *pdev)
};
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (!res)
+ return -EINVAL;
if (!devm_request_region(dev, res->start, WINB_REGION_SIZE, DRVNAME)) {
dev_err(dev, "Failed to request region 0x%lx-0x%lx\n",
(unsigned long)res->start,
--
2.25.1
Powered by blists - more mailing lists