mirror of https://github.com/acidanthera/audk.git
MdePkg UefiLib: Check Table against NULL in ScanTableInSDT
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1266
af5e952159
abstracted generic functions
from different modules (IntelVTdDxe, S3SaveStateDxe, PcRtc,
DpDynamicCommand and PiSmmCpuDxeSmm). Some of them (IntelVTdDxe and
PcRtc) checked Table against NULL before accessing Table->Signature,
some (S3SaveStateDxe, DpDynamicCommand and PiSmmCpuDxeSmm did not.
The ScanTableInSDT() in Acpi.c of UefiLib was mainly from
S3SaveStateDxe, so it does not check Table against NULL before
accessing Table->Signature.
This patch updates ScanTableInSDT() to check Table against NULL first
before accessing Table->Signature.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
parent
a2e61f341d
commit
e7ac09b957
|
@ -67,7 +67,7 @@ ScanTableInSDT (
|
||||||
EntryPtr = 0;
|
EntryPtr = 0;
|
||||||
CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), TablePointerSize);
|
CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), TablePointerSize);
|
||||||
Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr));
|
Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr));
|
||||||
if (Table->Signature == Signature) {
|
if ((Table != NULL) && (Table->Signature == Signature)) {
|
||||||
if (PreviousTable != NULL) {
|
if (PreviousTable != NULL) {
|
||||||
if (Table == PreviousTable) {
|
if (Table == PreviousTable) {
|
||||||
*PreviousTableLocated = TRUE;
|
*PreviousTableLocated = TRUE;
|
||||||
|
|
Loading…
Reference in New Issue