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