[PATCH][V2] acpi: acpidump: don't assume FPDT tables are correct about their record sizes (LP: #1375258)

Colin King colin.king at canonical.com
Wed Oct 1 09:07:52 UTC 2014


From: Colin Ian King <colin.king at canonical.com>

Section 5.2.23.4 and 5.2.23.5 Performance Record Formats of the
ACPI specification states that the length field is a minimum
of 16 bytes for these two record types. Currently fwts believes
this data from the firmware, however, some firmware has been known
to set this to zero causing fwts to loop on the dumping of multiple
records.

fwts should instead not trust this field and anything less than 16
bytes should be dumped out as a hex dump since it can't be decoded.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpi/acpidump/acpidump.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
index 7b45932..e3fe4b1 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -1641,6 +1641,15 @@ static void acpidump_fpdt(fwts_framework *fw, const fwts_acpi_table_info *table)
 	while (ptr < data + table->length) {
 		fwts_acpi_table_fpdt_header *fpdt = (fwts_acpi_table_fpdt_header *)ptr;
 
+		/* fpdt not long enough, bail out early */
+		if (fpdt->length < 16) {
+			size_t offset = ptr - data;
+			fwts_log_info_verbatum(fw, "Cannot decode FPDT header, size %" 
+				PRIu8 " less than 16 bytes. Data:", fpdt->length);
+			acpi_dump_raw_data(fw, ptr, table->length - offset, offset);
+			break;
+		}
+
 		fwts_log_nl(fw);
 
 		switch (fpdt->type) {
-- 
2.1.0




More information about the fwts-devel mailing list