]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: SRAT: Fix uninitialized memory usage
authorSami Mujawar <sami.mujawar@arm.com>
Mon, 18 Nov 2019 16:37:30 +0000 (16:37 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 31 Mar 2020 21:22:39 +0000 (21:22 +0000)
On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported for the Status variable in
AddGenericInitiatorAffinity() as it is not initialised
to a default value. This condition is only valid if
GenInitAffCount is equal to 0. Since GenInitAffCount
is already checked in BuildSratTable() this condition
can never happen.

The value of the Status variable is returned in
failure cases from appropriate locations in
AddGenericInitiatorAffinity(). The only case
where Status value is being used un-initialised
is the return statement at the end of
AddGenericInitiatorAffinity().

Therefore, to fix this issue EFI_SUCCESS can be
safely returned instead of returning the Status
variable at the end of the function.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiSratLibArm/SratGenerator.c

index 74cb7d92a5d8cddd3df8334f3ab55e6fa3e7267a..620e2929ef2460b6bf318fa85f8bca984608b955 100644 (file)
@@ -413,7 +413,7 @@ AddGenericInitiatorAffinity (
     GenInitAff++;\r
     GenInitAffInfo++;\r
   }// while\r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /** Construct the SRAT ACPI table.\r