DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
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 <edward.pickup@arm.com>
---
Change can be seen at https://github.com/edpickup/edk2/tree/2322_rmrnodecount_uninitialised_v1
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 40d99162cc610de2d0c2f0a5fff6e457c08d07fb..f28973c1a8620aa5b756e85af1b46ebfaf018839 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,
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92107): https://edk2.groups.io/g/devel/message/92107
Mute This Topic: https://groups.io/mt/92809989/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Edward,
Thank you for this patch.
This fix looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 04/08/2022 10:20 am, Edward Pickup wrote:
> 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 <edward.pickup@arm.com>
> ---
>
> Change can be seen at https://github.com/edpickup/edk2/tree/2322_rmrnodecount_uninitialised_v1
>
> DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> index 40d99162cc610de2d0c2f0a5fff6e457c08d07fb..f28973c1a8620aa5b756e85af1b46ebfaf018839 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,
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92177): https://edk2.groups.io/g/devel/message/92177
Mute This Topic: https://groups.io/mt/92809989/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.