[PATCH] acpi: bert: do not fail if BERT error region raw_data_length is zero

Ricardo Neri ricardo.neri-calderon at linux.intel.com
Wed Aug 17 20:51:34 UTC 2016


If there are no errors to report, the Boot Error Region pointed by the
BERT ACPI table in certain systems is populated with zeros. This implies
that the Raw Data Offset field will also be zero. In such a case, we will
not meet the condition

    error_region.raw_data_offset > sizeof(error_region) +
                                   error_region.data_length).           (1)

This is not an error if there is not raw data. Instead, fail the test case
only if error_region.raw_data_length is non-zero.

This brings FWTS in alignment with what Linux does to check the validity of
the BERT error region.

In order to not mask actual issues in the BERT error region and conserve
some of the current behavior, issue a warning when (1) is not met and add
commentary on the fact that there might not be raw data.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
---
 src/acpi/bert/bert.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/acpi/bert/bert.c b/src/acpi/bert/bert.c
index 19ce608..3dc48b6 100644
--- a/src/acpi/bert/bert.c
+++ b/src/acpi/bert/bert.c
@@ -126,12 +126,29 @@ static int bert_test1(fwts_framework *fw)
 			}
 			if (region->raw_data_offset <
 				sizeof(fwts_acpi_table_boot_error_region) + region->data_length) {
-				fwts_failed(fw, LOG_LEVEL_HIGH,
-					"BERTBootErrorRegionRawDataOffset",
-					"BERT Boot Error Region Raw Data Offset %" PRIu32
-						" is smaller than end of the data region",
-						region->raw_data_offset);
-				passed = false;
+				if (region->raw_data_length) {
+					fwts_failed(fw, LOG_LEVEL_HIGH,
+						"BERTBootErrorRegionRawDataOffset",
+						"BERT Boot Error Region Raw Data Offset %" PRIu32
+							" is smaller than end of the data region and"
+							" BERT Boot Error Region Raw Data Length %" PRIu32
+							" is non-zero.",
+							region->raw_data_offset,
+							region->raw_data_length);
+					passed = false;
+				} else {
+					fwts_warning(fw, "BERT Boot Error Region Raw Data Offset %"
+							PRIu32 " is smaller than end of the data"
+							"region. BERT Boot Error Region Data Lenght "
+							"is zero.",
+							region->raw_data_offset);
+					fwts_advice(fw,
+						"If there is raw data in the BERT Boot Error Region, "
+						"Raw Data Offset must be larger than the end of the "
+						"data region if there is raw data. However, since "
+						"BERT Boot Error Region Raw Data Lenght is zero, "
+						"this may mean that there is no raw data.");
+				}
 			}
 			if (region->raw_data_length + region->raw_data_offset > bert->boot_error_region_length) {
 				fwts_failed(fw, LOG_LEVEL_HIGH,
-- 
2.9.3




More information about the fwts-devel mailing list