char: hpet: fix a missing check of ioremap
authorKangjie Lu <kjlu@umn.edu>
Sat, 9 Mar 2019 03:50:24 +0000 (21:50 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 17:15:51 +0000 (02:15 +0900)
Check if ioremap fails, and if so, return AE_ERROR.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/hpet.c

index d0ad85900b7948e68d1654a410f2c5dde6e6511e..3a1e6b3ccd10d0203847614e16bafce03808fb30 100644 (file)
@@ -973,6 +973,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
        if (ACPI_SUCCESS(status)) {
                hdp->hd_phys_address = addr.address.minimum;
                hdp->hd_address = ioremap(addr.address.minimum, addr.address.address_length);
+               if (!hdp->hd_address)
+                       return AE_ERROR;
 
                if (hpet_is_known(hdp)) {
                        iounmap(hdp->hd_address);