It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: ec5e1a4b8faa ("hwmon: Convert vt8231 to a platform driver") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/vt8231.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 03275ac8ba72..394ba989b7ae 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c @@ -783,6 +783,8 @@ static int vt8231_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, VT8231_EXTENT, vt8231_driver.driver.name)) { dev_err(&pdev->dev, "Region 0x%lx-0x%lx already in use!\n", -- 2.25.1