It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: b74f3fdd98c7 ("hwmon: convert it87 to platform driver") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/hwmon/it87.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 0e543dbe0a6b..66e465ae6ecc 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -3041,6 +3041,8 @@ static int it87_probe(struct platform_device *pdev) struct device *hwmon_dev; res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -EINVAL; if (!devm_request_region(&pdev->dev, res->start, IT87_EC_EXTENT, DRVNAME)) { dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", -- 2.25.1