[edk2] [patch] UefiCpuPkg/MtrrLib:Fix VS2012 build failure

Dandan Bi posted 1 patch 7 years, 7 months ago
Failed in applying to current master (apply log)
UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++++
1 file changed, 4 insertions(+)
[edk2] [patch] UefiCpuPkg/MtrrLib:Fix VS2012 build failure
Posted by Dandan Bi 7 years, 7 months ago
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index 8e84272..c38191a 100644
--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
@@ -700,10 +700,11 @@ MtrrLibGetPositiveMtrrNumber (
   UINT64         SubLength;
   UINT32         MtrrNumber;
   BOOLEAN        UseLeastAlignment;
 
   UseLeastAlignment = TRUE;
+  SubLength = 0;
 
   //
   // Calculate the alignment of the base address.
   //
   for (MtrrNumber = 0; Length != 0; MtrrNumber++) {
@@ -852,10 +853,11 @@ MtrrLibGetMtrrNumber (
   UINT32  Index;
 
   *SubLeft = 0;
   *SubRight = 0;
   LeastSubtractiveMtrrNumber = 0;
+  BaseAlignment = 0;
 
   //
   // Get the optimal left subtraction solution.
   //
   if (BaseAddress != 0) {
@@ -1625,10 +1627,12 @@ MtrrLibSetMemoryAttributeInVariableMtrr (
   UINT32                    MtrrNumber;
   UINT32                    SubtractiveLeft;
   UINT32                    SubtractiveRight;
   BOOLEAN                   UseLeastAlignment;
 
+  Alignment = 0;
+
   MtrrNumber = MtrrLibGetMtrrNumber (Ranges, RangeCount, VariableMtrr, *VariableMtrrCount,
                                      BaseAddress, Length, Type, Alignment0, &SubtractiveLeft, &SubtractiveRight);
 
   if (MtrrNumber + *VariableMtrrCount > VariableMtrrCapacity) {
     return RETURN_OUT_OF_RESOURCES;
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] UefiCpuPkg/MtrrLib:Fix VS2012 build failure
Posted by Ni, Ruiyu 7 years, 7 months ago
Dandan,
Thank you! I thought I fixed all the build failures.

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>


Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Wednesday, April 5, 2017 9:07 AM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Fan, Jeff <jeff.fan@intel.com>
>Subject: [patch] UefiCpuPkg/MtrrLib:Fix VS2012 build failure
>
>Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Jeff Fan <jeff.fan@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Dandan Bi <dandan.bi@intel.com>
>---
> UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
>index 8e84272..c38191a 100644
>--- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
>+++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
>@@ -700,10 +700,11 @@ MtrrLibGetPositiveMtrrNumber (
>   UINT64         SubLength;
>   UINT32         MtrrNumber;
>   BOOLEAN        UseLeastAlignment;
>
>   UseLeastAlignment = TRUE;
>+  SubLength = 0;
>
>   //
>   // Calculate the alignment of the base address.
>   //
>   for (MtrrNumber = 0; Length != 0; MtrrNumber++) {
>@@ -852,10 +853,11 @@ MtrrLibGetMtrrNumber (
>   UINT32  Index;
>
>   *SubLeft = 0;
>   *SubRight = 0;
>   LeastSubtractiveMtrrNumber = 0;
>+  BaseAlignment = 0;
>
>   //
>   // Get the optimal left subtraction solution.
>   //
>   if (BaseAddress != 0) {
>@@ -1625,10 +1627,12 @@ MtrrLibSetMemoryAttributeInVariableMtrr (
>   UINT32                    MtrrNumber;
>   UINT32                    SubtractiveLeft;
>   UINT32                    SubtractiveRight;
>   BOOLEAN                   UseLeastAlignment;
>
>+  Alignment = 0;
>+
>   MtrrNumber = MtrrLibGetMtrrNumber (Ranges, RangeCount, VariableMtrr, *VariableMtrrCount,
>                                      BaseAddress, Length, Type, Alignment0, &SubtractiveLeft, &SubtractiveRight);
>
>   if (MtrrNumber + *VariableMtrrCount > VariableMtrrCapacity) {
>     return RETURN_OUT_OF_RESOURCES;
>--
>1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel