[PATCH 2/6] acpi: refactor length check by fwts_acpi_structure_length_check

Alex Hung alex.hung at canonical.com
Fri May 14 19:21:51 UTC 2021


Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/acpi/hmat/hmat.c | 7 +------
 src/acpi/pptt/pptt.c | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/acpi/hmat/hmat.c b/src/acpi/hmat/hmat.c
index 8a06f8b1..01b76100 100644
--- a/src/acpi/hmat/hmat.c
+++ b/src/acpi/hmat/hmat.c
@@ -182,13 +182,8 @@ static int hmat_test1(fwts_framework *fw)
 			break;
 		}
 
-		if (entry->length != type_length) {
+		if (!fwts_acpi_structure_length_check(fw, "HMAT", entry->type, entry->length, type_length)) {
 			passed = false;
-			fwts_failed(fw, LOG_LEVEL_CRITICAL,
-				"HMATBadSubtableLength",
-				"HMAT subtable Type 0x%2.2" PRIx8 " should have "
-				"length 0x%2.2" PRIx8 ", got 0x%2.2" PRIx8,
-				entry->type, entry->length, type_length);
 			break;
 		}
 
diff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c
index c436ab82..8656e979 100644
--- a/src/acpi/pptt/pptt.c
+++ b/src/acpi/pptt/pptt.c
@@ -146,13 +146,8 @@ static int pptt_test1(fwts_framework *fw)
 			break;
 		}
 
-		if (entry->length != type_length) {
+		if (!fwts_acpi_structure_length_check(fw, "PPTT", entry->type, entry->length, type_length)) {
 			passed = false;
-			fwts_failed(fw, LOG_LEVEL_CRITICAL,
-				"PPTTBadSubtableLength",
-				"PPTT subtable Type 0x%2.2" PRIx8 " should have "
-				"length 0x%2.2" PRIx8 ", got 0x%2.2" PRIx8,
-				entry->type, type_length, entry->length);
 			break;
 		}
 
-- 
2.31.1




More information about the fwts-devel mailing list