[PATCH 4/8] acpi: pcc: add safe memory read check on mmap'd PCC header
Colin King
colin.king at canonical.com
Fri Jul 14 09:52:21 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/pcc/pcc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/acpi/pcc/pcc.c b/src/acpi/pcc/pcc.c
index fff406aa..6b2f37af 100644
--- a/src/acpi/pcc/pcc.c
+++ b/src/acpi/pcc/pcc.c
@@ -115,6 +115,13 @@ static void pcc_check_pcc_header(
"..0x%" PRIx64 ".", addr, addr + length);
return;
}
+ /* Ensure header can be read */
+ if (fwts_safe_memread(hdr, length) != FWTS_OK) {
+ fwts_log_info(fw, "Cannot read PCC header 0x%" PRIx64
+ "..0x%" PRIx64 ".", addr, addr + length);
+ fwts_munmap(hdr, (size_t)length);
+ return;
+ }
fwts_log_info_verbatim(fw, "PCC header at 0x%" PRIx64 ".", addr);
fwts_log_info_verbatim(fw, " Signature: 0x%" PRIx32, hdr->signature);
--
2.11.0
More information about the fwts-devel
mailing list