[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220422091207.4034406-8-yangyingliang@huawei.com>
Date: Fri, 22 Apr 2022 17:11:54 +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 07/20] hwmon: (lm78) 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: c40769fee13c ("hwmon/lm78: No longer use i2c-isa")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/hwmon/lm78.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 5e129cbec1cb..71c2a1bc75cc 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -792,6 +792,8 @@ static int lm78_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(dev, res->start + LM78_ADDR_REG_OFFSET,
2, "lm78"))
return -EBUSY;
--
2.25.1
Powered by blists - more mailing lists