From 3e599bbc105ff089b21b6024100d585a8c781328 Mon Sep 17 00:00:00 2001 From: Edward Pickup Date: Thu, 4 Aug 2022 10:20:50 +0100 Subject: DynamicTablesPkg: Fix using RmrNodeCount unitlitialised Fix using RmrNodeCount uninitliased by initliasing it to zero. Also, add an additional check for ACPI version. This fixes a crash running on kvmtool. Signed-off-by: Edward Pickup Reviewed-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'DynamicTablesPkg/Library') diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index 40d99162cc..f28973c1a8 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -2107,6 +2107,8 @@ BuildIortTable ( ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID); ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature); + RmrNodeCount = 0; + if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) || (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision)) { @@ -2714,7 +2716,10 @@ BuildIortTable ( } } - if (RmrNodeCount > 0) { + if ((AcpiTableInfo->AcpiTableRevision >= + EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05) && + (RmrNodeCount > 0)) + { Status = AddRmrNodes ( This, CfgMgrProtocol, -- cgit v1.2.3