Re: [edk2] [PATCH] MdeModulePkg: AcpiTableDxe: fix VS2008 build by merging adjacent if blocks

2016-02-25 Thread Zeng, Star

On 2016/2/26 0:25, Ard Biesheuvel wrote:

The assignment of CurrentRsdtEntry and its subsequent dereference are
subject to the same condition, but for some reason, VS2008 does not see
that and warns about the dereference possibly involving an uninitialized
pointer. Since the single statememt between the blocks is unrelated, we
can just move it and merge the two conditional blocks together.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 22 
+---
  1 file changed, 10 insertions(+), 12 deletions(-)


Reviewed-by: Star Zeng 



diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c 
b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index f069458b1cba..f6229ca05c10 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -963,6 +963,16 @@ AddTableToList (
 AcpiTableInstance->NumberOfTableEntries3 *
 sizeof (UINT32)
   );
+
+//
+// Add entry to the RSDT
+//
+*CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
+
+//
+// Update RSDT length
+//
+AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + 
sizeof (UINT32);
}

//
@@ -977,18 +987,6 @@ AddTableToList (
sizeof (UINT64)
  );

-  if ((PcdGet32 (PcdAcpiExposedTableVersions) & 
EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
-//
-// Add entry to the RSDT
-//
-*CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
-
-//
-// Update RSDT length
-//
-AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + 
sizeof (UINT32);
-  }
-
//
// Add entry to XSDT, XSDT expects 64 bit pointers, but
// the table pointers in XSDT are not aligned on 8 byte boundary.



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


Re: [edk2] [PATCH] MdeModulePkg: AcpiTableDxe: fix VS2008 build by merging adjacent if blocks

2016-02-25 Thread David Woodhouse
On Thu, 2016-02-25 at 17:25 +0100, Ard Biesheuvel wrote:
> The assignment of CurrentRsdtEntry and its subsequent dereference are
> subject to the same condition, but for some reason, VS2008 does not see
> that and warns about the dereference possibly involving an uninitialized
> pointer. Since the single statememt between the blocks is unrelated, we
> can just move it and merge the two conditional blocks together.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel 

This fixes the build for me; thanks.

Reviewed-by: David Woodhouse 

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] MdeModulePkg: AcpiTableDxe: fix VS2008 build by merging adjacent if blocks

2016-02-25 Thread Ard Biesheuvel
The assignment of CurrentRsdtEntry and its subsequent dereference are
subject to the same condition, but for some reason, VS2008 does not see
that and warns about the dereference possibly involving an uninitialized
pointer. Since the single statememt between the blocks is unrelated, we
can just move it and merge the two conditional blocks together.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 22 
+---
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c 
b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index f069458b1cba..f6229ca05c10 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -963,6 +963,16 @@ AddTableToList (
AcpiTableInstance->NumberOfTableEntries3 *
sizeof (UINT32)
  );
+
+//
+// Add entry to the RSDT
+//
+*CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
+
+//
+// Update RSDT length
+//
+AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + 
sizeof (UINT32);
   }
 
   //
@@ -977,18 +987,6 @@ AddTableToList (
   sizeof (UINT64)
 );
 
-  if ((PcdGet32 (PcdAcpiExposedTableVersions) & 
EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
-//
-// Add entry to the RSDT
-//
-*CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
-
-//
-// Update RSDT length
-//
-AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + 
sizeof (UINT32);
-  }
-
   //
   // Add entry to XSDT, XSDT expects 64 bit pointers, but
   // the table pointers in XSDT are not aligned on 8 byte boundary.
-- 
2.5.0

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