DynamicTablesPkg: Add frame number validation to GTDT generator
authorKrzysztof Koch <krzysztof.koch@arm.com>
Wed, 10 Apr 2019 10:28:55 +0000 (11:28 +0100)
committerSami Mujawar <sami.mujawar@arm.com>
Mon, 10 Jun 2019 19:03:40 +0000 (20:03 +0100)
Added code to check if the Generic Timer Block Structure's frame number
provided by the platform repository is within the allowed range (0-7).

References:
- ACPI 6.2 Errata A, Table 5-122, September 2017

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c

index 8d9ddcf..543e6f4 100644 (file)
@@ -218,6 +218,15 @@ AddGTBlockTimerFrames (
       GtBlockFrame\r
       ));\r
 \r
+    if (GTBlockTimerFrameList->FrameNumber >= 8) {\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "ERROR: GTDT: Frame number %d is not in the range 0-7\n",\r
+        GTBlockTimerFrameList->FrameNumber\r
+      ));\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
+\r
     GtBlockFrame->GTFrameNumber = GTBlockTimerFrameList->FrameNumber;\r
     GtBlockFrame->Reserved[0] = EFI_ACPI_RESERVED_BYTE;\r
     GtBlockFrame->Reserved[1] = EFI_ACPI_RESERVED_BYTE;\r