[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220422091207.4034406-9-yangyingliang@huawei.com>
Date: Fri, 22 Apr 2022 17:11:55 +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 08/20] hwmon: (nct6683) 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: 41082d66bfd6 ("hwmon: Driver for NCT6683D")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/hwmon/nct6683.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index 6a9f420e7d32..12cac70ff493 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -1197,6 +1197,8 @@ static int nct6683_probe(struct platform_device *pdev)
char build[16];
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