diff options
Diffstat (limited to 'MdePkg')
4 files changed, 19 insertions, 11 deletions
diff --git a/MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c b/MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c index 4e140c61c8..28649f72cc 100644 --- a/MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c +++ b/MdePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c @@ -1,7 +1,7 @@ /** @file
Report Status Code Library for DXE Phase.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -57,6 +57,9 @@ InternalReportStatusCode ( // in the handle database.
//
if (gStatusCode == NULL) {
+ if (gBS == NULL) {
+ return EFI_UNSUPPORTED;
+ }
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
if (EFI_ERROR (Status) || gStatusCode == NULL) {
return EFI_UNSUPPORTED;
@@ -476,6 +479,10 @@ ReportStatusCodeEx ( ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
+ if (gBS == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
//
// Allocate space for the Status Code Header and its buffer
//
diff --git a/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c b/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c index 0db4707e29..26f62f6c95 100644 --- a/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c +++ b/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c @@ -1,7 +1,7 @@ /** @file
UEFI Boot Services Table Library.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -14,9 +14,9 @@ **/
-EFI_HANDLE gImageHandle;
-EFI_SYSTEM_TABLE *gST;
-EFI_BOOT_SERVICES *gBS;
+EFI_HANDLE gImageHandle = NULL;
+EFI_SYSTEM_TABLE *gST = NULL;
+EFI_BOOT_SERVICES *gBS = NULL;
/**
The constructor function caches the pointer of Boot Services Table.
@@ -43,6 +43,7 @@ UefiBootServicesTableLibConstructor ( // Cache the Image Handle
//
gImageHandle = ImageHandle;
+ ASSERT (gImageHandle != NULL);
//
// Cache pointer to the EFI System Table
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c index 3fe3b6e043..b3e83894c8 100644 --- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c @@ -1,7 +1,7 @@ /** @file
UEFI Debug Library that uses PrintLib to send messages to CONOUT.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -65,7 +65,7 @@ DebugPrint ( //
// Send the print string to the Console Output device
//
- if (gST->ConOut != NULL) {
+ if ((gST != NULL) && (gST->ConOut != NULL)) {
gST->ConOut->OutputString (gST->ConOut, Buffer);
}
}
@@ -112,7 +112,7 @@ DebugAssert ( //
// Send the print string to the Console Output device
//
- if (gST->ConOut != NULL) {
+ if ((gST != NULL) && (gST->ConOut != NULL)) {
gST->ConOut->OutputString (gST->ConOut, Buffer);
}
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c index 9338217762..d2fb46e23f 100644 --- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c @@ -1,7 +1,7 @@ /** @file
UEFI Debug Library that uses PrintLib to send messages to STDERR.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -65,7 +65,7 @@ DebugPrint ( //
// Send the print string to the Standard Error device
//
- if (gST->StdErr != NULL) {
+ if ((gST != NULL) && (gST->StdErr != NULL)) {
gST->StdErr->OutputString (gST->StdErr, Buffer);
}
}
@@ -112,7 +112,7 @@ DebugAssert ( //
// Send the print string to the Standard Error device
//
- if (gST->StdErr != NULL) {
+ if ((gST != NULL) && (gST->StdErr != NULL)) {
gST->StdErr->OutputString (gST->StdErr, Buffer);
}
|