Merge pull request #504 from SchmErik/dt-label

iASL: DT: detect invalid field labels
This commit is contained in:
Robert Moore 2019-08-30 13:10:57 -07:00 committed by GitHub
commit e32cc0a3e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -410,7 +410,7 @@ AcpiDmDumpStao (
Namepath = ACPI_ADD_PTR (char, Table, Offset); Namepath = ACPI_ADD_PTR (char, Table, Offset);
StringLength = strlen (Namepath) + 1; StringLength = strlen (Namepath) + 1;
AcpiDmLineHeader (Offset, StringLength, "Namestring"); AcpiDmLineHeader (Offset, StringLength, "Namepath");
AcpiOsPrintf ("\"%s\"\n", Namepath); AcpiOsPrintf ("\"%s\"\n", Namepath);
/* Point to next namepath */ /* Point to next namepath */

View File

@ -387,7 +387,8 @@ const char *AslTableCompilerMsgs [] =
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" /* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected"
}; };
/* Preprocessor */ /* Preprocessor */

View File

@ -387,6 +387,7 @@ typedef enum
ASL_MSG_UNKNOWN_SUBTABLE, ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_UNKNOWN_TABLE, ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_ZERO_VALUE, ASL_MSG_ZERO_VALUE,
ASL_MSG_INVALID_LABEL,
/* These messages are used by the Preprocessor only */ /* These messages are used by the Preprocessor only */

View File

@ -646,6 +646,14 @@ DtCompileTable (
FieldType = DtGetFieldType (Info); FieldType = DtGetFieldType (Info);
AslGbl_InputFieldCount++; AslGbl_InputFieldCount++;
if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE &&
strcmp (Info->Name, LocalField->Name))
{
sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"",
LocalField->Name, Info->Name);
DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer);
}
switch (FieldType) switch (FieldType)
{ {
case DT_FIELD_TYPE_FLAGS_INTEGER: case DT_FIELD_TYPE_FLAGS_INTEGER: