]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg AcpiTableDxe: Use Rsdt to check against NULL
authorStar Zeng <star.zeng@intel.com>
Mon, 7 Mar 2016 06:01:46 +0000 (14:01 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 8 Mar 2016 10:05:16 +0000 (18:05 +0800)
Some static scan tool may regard CurrentRsdtEntry to be potentially
referenced to NULL pointer if CurrentRsdtEntry == NULL is used in
the right above if condition judgment.

        CopyMem (CurrentRsdtEntry, CurrentRsdtEntry + 1, (*NumberOfTableEntries - Index) * sizeof (UINT32));

It is introduced by commit f9bbb8d9c3f065faba9f266cf4e731fe2ca70c4d.
To avoid it and have same style with
"((Xsdt == NULL) || CurrentTablePointer64 == (UINT64) (UINTN) Table->Table)",
use Rsdt instead of CurrentRsdtEntry to check against NULL.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Shumin Qiu <shumin.qiu@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

index f6229ca05c101ab2bf1ea4f8f7be03c1ab88d1ea..7f95b9dc709d595a8802caac00711053bf46b54e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ACPI Table Protocol Implementation\r
 \r
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -1132,7 +1132,7 @@ RemoveTableFromRsdt (
     //\r
     // Check if we have found the corresponding entry in both RSDT and XSDT\r
     //\r
-    if ((CurrentRsdtEntry == NULL || *CurrentRsdtEntry == (UINT32) (UINTN) Table->Table) &&\r
+    if (((Rsdt == NULL) || *CurrentRsdtEntry == (UINT32) (UINTN) Table->Table) &&\r
         ((Xsdt == NULL) || CurrentTablePointer64 == (UINT64) (UINTN) Table->Table)\r
         ) {\r
       //\r