[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220422091207.4034406-19-yangyingliang@huawei.com>
Date: Fri, 22 Apr 2022 17:12:05 +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 18/20] hwmon: (w83627ehf) 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: 1ea6dd3840e5 ("hwmon/w83627ehf: Convert to a platform driver")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/hwmon/w83627ehf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index af89b32a93a5..5d5a7a66d420 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1703,6 +1703,8 @@ static int __init w83627ehf_probe(struct platform_device *pdev)
struct device *hwmon_dev;
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (!res)
+ return -EINVAL;
if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME))
return -EBUSY;
--
2.25.1
Powered by blists - more mailing lists