ShellPkg/Acpiview: Refactor EINJ table parser validation ACPI defines Injection Header Size as the length of the EINJ injection header, not necessarily the absolute offset of the instruction entries. Update parser validation to use the correct entry offset calculation and accept the layout used by Linux and existing firmware tables. Signed-off-by: Simon Wang <simowang@nvidia.com>
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c index d01b15f..5e5dc08 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c
@@ -327,7 +327,9 @@ ); // Validate Error Source Descriptors Count. - if ((mEinjInjectionHdrSize == NULL) || (*mEinjInjectionHdrSize != Offset)) { + if ((mEinjInjectionHdrSize == NULL) || + (*mEinjInjectionHdrSize != (Offset - sizeof (EFI_ACPI_DESCRIPTION_HEADER)))) + { IncrementErrorCount (); Print (L"ERROR: Invalid Injection Header...\n"); return;