It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: e53004e20a58 ("[PATCH] hwmon: New f71805f driver") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/f71805f.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 7f20edb0677c..7d88e7647074 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -1384,6 +1384,8 @@ static int f71805f_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -EINVAL; if (!devm_request_region(&pdev->dev, res->start + ADDR_REG_OFFSET, 2, DRVNAME)) { dev_err(&pdev->dev, "Failed to request region 0x%lx-0x%lx\n", -- 2.25.1