It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: ab41319eab3b ("hwmon: New driver for the VIA VT1211") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/vt1211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index 4a5e911d26eb..4b1448e7f1c0 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c @@ -1152,6 +1152,8 @@ static int vt1211_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -EINVAL; if (!devm_request_region(dev, res->start, resource_size(res), DRVNAME)) { dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", -- 2.25.1