DynamicTablesPkg: add validation for PcdNonBsaCompliant16550SerialHid

According to ACPI 6.4, 6.1.5 _HID states:

  - A valid PNP ID must be of the form "AAA####" where A is an uppercase
    letter and # is a hex digit.
  - A valid ACPI ID must be of the form "NNNN####" where N is an uppercase
    letter or a digit ('0'-'9') and # is a hex digit.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Joey Gouly
2021-04-09 13:00:58 +01:00
committed by mergify[bot]
parent 54211ab10f
commit 16136f218d
3 changed files with 113 additions and 2 deletions

View File

@ -148,6 +148,10 @@ FixupIds (
// If there is a non-BSA compliant HID, use that.
NonBsaHid = (CONST CHAR8*)PcdGetPtr (PcdNonBsaCompliant16550SerialHid);
if ((NonBsaHid != NULL) && (AsciiStrLen (NonBsaHid) != 0)) {
if (!(IsValidPnpId (NonBsaHid) || IsValidAcpiId (NonBsaHid))) {
return EFI_INVALID_PARAMETER;
}
HidString = NonBsaHid;
CidString = "";
} else {