summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2020-01-20 19:13:43 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-02-11 02:12:45 +0000
commit54d33a53145bcf82622ea5a784ac2af99de06d55 (patch)
tree7ca5fa6ccfe80e92827c17b921eb644cf1c2ac38 /ShellPkg/Library
parentf69248d09351ea742667749c9bdeca35e94dd946 (diff)
downloadedk2-54d33a53145bcf82622ea5a784ac2af99de06d55.tar.gz
edk2-54d33a53145bcf82622ea5a784ac2af99de06d55.tar.bz2
edk2-54d33a53145bcf82622ea5a784ac2af99de06d55.zip
ShellPkg: acpiview: FADT: Validate global pointer before use
Check if global pointers have been successfully updated before they are used for further table parsing. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
index 8acfbac3b1..d86718bab6 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
@@ -1,7 +1,7 @@
/** @file
FADT table parser
- Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -230,9 +230,11 @@ ParseAcpiFadt (
);
if (Trace) {
- Print (L"\nSummary:\n");
- PrintFieldName (2, L"FADT Version");
- Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
+ if (FadtMinorRevision != NULL) {
+ Print (L"\nSummary:\n");
+ PrintFieldName (2, L"FADT Version");
+ Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
+ }
if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
IncrementErrorCount ();
@@ -294,21 +296,20 @@ ParseAcpiFadt (
);
}
- // If X_DSDT is not zero then use X_DSDT and ignore DSDT,
- // else use DSDT.
- if (*X_DsdtAddress != 0) {
+ // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
+ if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress);
- } else if (*DsdtAddress != 0) {
+ } else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress);
} else {
- // Both DSDT and X_DSDT cannot be zero.
+ // Both DSDT and X_DSDT cannot be invalid.
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (Trace) {
// The DSDT Table is mandatory for ARM systems
// as the CPU information MUST be presented in
// the DSDT.
IncrementErrorCount ();
- Print (L"ERROR: Both X_DSDT and DSDT are NULL.\n");
+ Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
}
#endif
return;