[PATCH 2/8] acpi: hpet: add safe memory read check on mmap'd memory
Colin King
colin.king at canonical.com
Fri Jul 14 09:52:19 UTC 2017
From: Colin Ian King <colin.king at canonical.com>
Ensure we can read the mmap'd memory.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpi/hpet/hpet.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/acpi/hpet/hpet.c b/src/acpi/hpet/hpet.c
index e6a3d4c3..15917d40 100644
--- a/src/acpi/hpet/hpet.c
+++ b/src/acpi/hpet/hpet.c
@@ -428,6 +428,12 @@ static int hpet_check_test4(fwts_framework *fw)
return FWTS_ERROR;
}
+ if (fwts_safe_memread(hpet_base_v, HPET_REG_SIZE) != FWTS_OK) {
+ fwts_log_info(fw, "Test skipped because HPET region cannot be read.");
+ (void)fwts_munmap(hpet_base_v, HPET_REG_SIZE);
+ return FWTS_SKIP;
+ }
+
hpet_id = *(uint64_t*) hpet_base_v;
vendor_id = (hpet_id & 0xffff0000) >> 16;
--
2.11.0
More information about the fwts-devel
mailing list