[PATCH] syntaxcheck: report IASL compiler remarks as low failures (LP: #1200606)

Colin King colin.king at canonical.com
Mon Sep 23 19:08:34 UTC 2013


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

IASL outputs some very helpful and informative remarks that actually catch
some interesting errors, such as serialization bugs in methods and timeout
truncations.  So it seems pertinent to add these to the syntaxcheck json
database and expand the syntaxcheck test to catch remarks and report on
them too.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 data/syntaxcheck.json              | 34 +++++++++++++++++++++++++++++++++-
 src/acpi/syntaxcheck/syntaxcheck.c | 28 ++++++++++++++++++++--------
 2 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/data/syntaxcheck.json b/data/syntaxcheck.json
index e56247b..4519354 100644
--- a/data/syntaxcheck.json
+++ b/data/syntaxcheck.json
@@ -131,7 +131,7 @@
   },
   {
    "id": "ASL_MSG_COMPILER_RESERVED",
-   "advice": "This normally occurs when disassembled code is being compiled and it contains compiler-emitted names of the form '_T_x'.  This is just a remark generated by the compiler can can normally be ignored."
+   "advice": "This normally occurs when disassembled code is being compiled and it contains compiler-emitted names of the form '_T_x'.  This is just a remark generated by the compiler and can normally be ignored."
   },
   {
    "id": "ASL_MSG_RETURN_TYPES",
@@ -301,6 +301,38 @@
   {
    "id": "ASL_MSG_UPPER_CASE",
    "advice": "Characters in literal string that are not hexadecimal letters must be upper case."
+  },
+  {
+   "id": "ASL_MSG_RECURSION",
+   "advice": "Internal IASL Node recursion detected."
+  },
+  {
+   "id": "ASL_MSG_LOCAL_OUTSIDE_METHOD",
+   "advice": "A local variable was used outside of a control method, or there is an error in the method declaration."
+  },
+  {
+   "id": "ASL_MSG_NOT_PARAMETER",
+   "advice": "Argument to the method is not a real argument."
+  },
+  {
+   "id": "ASL_MSG_SERIALIZED_REQUIRED",
+   "advice": "A named object is created inside a non-serialized method - this method should be serialized. It is possible that one thread enters the method and blocks and then a second thread also executes the method, ending up in two attempts to create the object and causing a failure."
+  },
+  {
+   "id": "ASL_MSG_TRUNCATION",
+   "advice": "A truncation on a integer value has occurred. For example, a 32 bit value for a 16 bit timeout has been used."
+  },
+  {
+   "id": "ASL_MSG_LIST_LENGTH_SHORT",
+   "advice": "The provided data is actually shorter than the specified length, for example in an ACPI buffer containing vendor data."
+  },
+  {
+   "id": "ASL_MSG_PACKAGE_LENGTH",
+   "advice": "The package is larger than expected, hence wasting some space."
+  },
+  {
+   "id": "ASL_MSG_RESERVED_PACKAGE_LENGTH",
+   "advice": "The package is smaller than required."
   }
  ]
 }
diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c
index 55bcc7e..9bd6711 100644
--- a/src/acpi/syntaxcheck/syntaxcheck.c
+++ b/src/acpi/syntaxcheck/syntaxcheck.c
@@ -211,6 +211,16 @@ static syntaxcheck_error_map_item syntaxcheck_error_map[] = {
     ASL_ID(ASL_MSG_UNKNOWN_SUBTABLE),
     ASL_ID(ASL_MSG_UNKNOWN_TABLE),
     ASL_ID(ASL_MSG_ZERO_VALUE),
+    ASL_ID(ASL_MSG_RECURSION),
+    ASL_ID(ASL_MSG_SERIALIZED_REQUIRED),
+    ASL_ID(ASL_MSG_LOCAL_OUTSIDE_METHOD),
+    ASL_ID(ASL_MSG_NOT_PARAMETER),
+    ASL_ID(ASL_MSG_TRUNCATION),
+    ASL_ID(ASL_MSG_LIST_LENGTH_SHORT),
+    ASL_ID(ASL_MSG_PACKAGE_LENGTH),
+    ASL_ID(ASL_MSG_RESERVED_PACKAGE_LENGTH),
+    ASL_ID(ASL_MSG_LIST_LENGTH_SHORT),
+
     { 0, NULL, NULL }
 };
 
@@ -429,6 +439,7 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which)
 	fwts_list_link *item;
 	int errors = 0;
 	int warnings = 0;
+	int remarks = 0;
 	fwts_acpi_table_info *table;
 	fwts_list* iasl_errors;
 	fwts_list* iasl_disassembly;
@@ -463,12 +474,13 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which)
 					char *error_text = fwts_text_list_text(item->next);
 					int iasl_error = (strstr(error_text, "Error") != NULL);
 					int iasl_warning = (strstr(error_text, "Warning") != NULL);
+					int iasl_remark = (strstr(error_text, "Remark") != NULL);
 					int error_code;
 
 					sscanf(error_text, "%*s %d", &error_code);
 
 					/* Valid error or warning, go and report */
-					if (iasl_error || iasl_warning) {
+					if (iasl_error || iasl_warning || iasl_remark) {
 						char label[64];
 						char *colon = strstr(line, ":");
 						char *carat = strstr(error_text, "^");
@@ -511,7 +523,7 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which)
 							fwts_failed(fw, LOG_LEVEL_HIGH, label, "Assembler error in line %d", num);
 							break;
 						case ASL_REMARK:
-							fwts_log_info(fw, "Assembler remark in line %d", num);
+							fwts_failed(fw, LOG_LEVEL_LOW, label, "Assembler remark in line %d", num);
 							break;
 						case ASL_OPTIMIZATION:
 							skip = true;
@@ -530,6 +542,7 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which)
 					}
 					errors += iasl_error;
 					warnings += iasl_warning;
+					remarks += iasl_remark;
 					item = item->next;
 				}
 				else {
@@ -544,12 +557,11 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which)
 	fwts_text_list_free(iasl_disassembly);
 	fwts_text_list_free(iasl_errors);
 
-	if (errors > 0) {
-		fwts_log_info(fw, "Table %s (%d) reassembly: Found %d errors, %d warnings.", tablename, which, errors, warnings);
-	} else if (warnings > 0) {
-		fwts_log_info(fw, "Table %s (%d) reassembly: Found 0 errors, %d warnings.", tablename, which, warnings);
-	} else
-		fwts_passed(fw, "%s (%d) reassembly, Found 0 errors, 0 warnings.", tablename, which);
+	if (errors + warnings + remarks > 0)
+		fwts_log_info(fw, "Table %s (%d) reassembly: Found %d errors, %d warnings, %d remarks.",
+			tablename, which, errors, warnings, remarks);
+	else
+		fwts_passed(fw, "%s (%d) reassembly, Found 0 errors, 0 warnings, 0 remarks.", tablename, which);
 
 	fwts_log_nl(fw);
 
-- 
1.8.3.2




More information about the fwts-devel mailing list