Message ID | 20220422091207.4034406-13-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: check return value after calling platform_get_resource() | expand |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 018cb5a7651f..b664c306d087 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c @@ -579,6 +579,8 @@ static int sis5595_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(&pdev->dev, res->start, SIS5595_EXTENT, sis5595_driver.driver.name)) return -EBUSY;
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: 17e7dc4373df ("hwmon/sis5595: Convert to a platform driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/hwmon/sis5595.c | 2 ++ 1 file changed, 2 insertions(+)