From patchwork Mon Sep 29 15:00:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 394488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 6EC5114010C; Tue, 30 Sep 2014 01:00:20 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XYcR0-0006Mb-39; Mon, 29 Sep 2014 15:00:18 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XYcQu-0006MJ-Nf for fwts-devel@lists.ubuntu.com; Mon, 29 Sep 2014 15:00:12 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginm.net ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XYcQu-000219-L9 for fwts-devel@lists.ubuntu.com; Mon, 29 Sep 2014 15:00:12 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: acpidump: don't assume FPDT tables are correct about their record sizes (LP: #1375258) Date: Mon, 29 Sep 2014 16:00:11 +0100 Message-Id: <1412002812-26466-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 2.1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Section 5.2.23.4 and 5.2.23.5 Performance Record Formats of the ACPI specification states that the length field is 16 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 assume it is 16 bytes; anything smaller should be dumped out as a hex dump, otherwise it can be dumped correctly. Signed-off-by: Colin Ian King --- src/acpi/acpidump/acpidump.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c index 7b45932..b42363c 100644 --- a/src/acpi/acpidump/acpidump.c +++ b/src/acpi/acpidump/acpidump.c @@ -1641,6 +1641,12 @@ 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; + if (fpdt->length != 16) { + size_t offset = ptr - data; + acpi_dump_raw_data(fw, ptr, table->length - offset, offset); + break; + } + fwts_log_nl(fw); switch (fpdt->type) { @@ -1680,7 +1686,7 @@ static void acpidump_fpdt(fwts_framework *fw, const fwts_acpi_table_info *table) acpi_dump_raw_data(fw, ptr + fpdt_hdr_len, fpdt->length - fpdt_hdr_len, ptr + fpdt_hdr_len - data); break; } - ptr += fpdt->length; + ptr += 16; } }