lkml.org 
[lkml]   [2022]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/20] hwmon: (dme1737) check return value after calling platform_get_resource()
Date
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Fixes: e95c237d78c0 ("hwmon: (dme1737) Add sch311x support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/hwmon/dme1737.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index e3ad4c2d0038..90281a016118 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -2633,6 +2633,8 @@ static int dme1737_isa_probe(struct platform_device *pdev)
int err;

res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (!res)
+ return -EINVAL;
if (!devm_request_region(dev, res->start, DME1737_EXTENT, "dme1737")) {
dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n",
(unsigned short)res->start,
--
2.25.1
\
 
 \ /
  Last update: 2022-04-22 11:01    [W:0.129 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site