[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220422091207.4034406-15-yangyingliang@huawei.com>
Date: Fri, 22 Apr 2022 17:12:01 +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 14/20] hwmon: (smsc47m1) 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: 51f2cca1f72d ("hwmon/smsc47m1: Convert to a platform driver")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/hwmon/smsc47m1.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 37531b5c8254..0dc432af7b18 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -719,6 +719,8 @@ static int __init smsc47m1_probe(struct platform_device *pdev)
};
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (!res)
+ return -EINVAL;
err = smsc47m1_handle_resources(res->start, sio_data->type,
REQUEST, dev);
if (err < 0)
--
2.25.1
Powered by blists - more mailing lists