summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c10
-rw-r--r--MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c12
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c28
-rw-r--r--MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c4
-rw-r--r--MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c5
5 files changed, 37 insertions, 22 deletions
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index a7f0225..7d32d9a 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
@@ -1096,10 +1096,8 @@ ConPlatformMatchDevicePaths (
//
// If performing Delete operation, the NewDevicePath must not be NULL.
//
- if (Delete) {
- if (NewDevicePath == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ if (Delete && (NewDevicePath == NULL)) {
+ return EFI_INVALID_PARAMETER;
}
TempDevicePath1 = NULL;
@@ -1178,6 +1176,8 @@ ConPlatformUpdateDeviceVariable (
EFI_DEVICE_PATH_PROTOCOL *VariableDevicePath;
EFI_DEVICE_PATH_PROTOCOL *NewVariableDevicePath;
+ Status = EFI_SUCCESS;
+
VariableDevicePath = NULL;
NewVariableDevicePath = NULL;
@@ -1187,7 +1187,7 @@ ConPlatformUpdateDeviceVariable (
// it is the caller's responsibility to free the memory before return.
//
VariableDevicePath = ConPlatformGetVariable (VariableName);
-
+ // At this point, VariableDevicePath may be null. This is expected.
if (Operation != Delete) {
//
// Match specified DevicePath in Console Variable.
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index facb813..50a88f5 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -257,7 +257,10 @@ InitializeGraphicsConsoleTextMode (
// Reserve 2 modes for 80x25, 80x50 of graphics console.
//
NewModeBuffer = AllocateZeroPool (sizeof (GRAPHICS_CONSOLE_MODE_DATA) * (Count + 2));
- ASSERT (NewModeBuffer != NULL);
+ if (NewModeBuffer == NULL) {
+ ASSERT (NewModeBuffer != NULL);
+ return EFI_OUT_OF_RESOURCES;
+ }
//
// Mode 0 and mode 1 is for 80x25, 80x50 according to UEFI spec.
@@ -422,7 +425,7 @@ GraphicsConsoleControllerDriverStart (
//
MaxMode = Private->GraphicsOutput->Mode->MaxMode;
- for (ModeIndex = 0; ModeIndex < MaxMode; ModeIndex++) {
+ for (ModeIndex = 0; (UINTN)ModeIndex < MaxMode; ModeIndex++) {
Status = Private->GraphicsOutput->QueryMode (
Private->GraphicsOutput,
ModeIndex,
@@ -1802,7 +1805,10 @@ RegisterFontPackage (
PackageLength = sizeof (EFI_HII_SIMPLE_FONT_PACKAGE_HDR) + mNarrowFontSize + 4;
Package = AllocateZeroPool (PackageLength);
- ASSERT (Package != NULL);
+ if (Package == NULL) {
+ ASSERT (Package != NULL);
+ return;
+ }
WriteUnaligned32 ((UINT32 *)Package, PackageLength);
SimplifiedFont = (EFI_HII_SIMPLE_FONT_PACKAGE_HDR *)(Package + 4);
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 50f79f5..2f45571 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -1265,19 +1265,21 @@ TerminalRemoveConsoleDevVariable (
FreePool (OriginalVariable);
if (FoundOne) {
- VariableSize = GetDevicePathSize (NewVariable);
-
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableSize,
- NewVariable
- );
- //
- // Shrinking variable with existing variable driver implementation shouldn't fail.
- //
- ASSERT_EFI_ERROR (Status);
+ if (NewVariable != NULL) {
+ VariableSize = GetDevicePathSize (NewVariable);
+
+ Status = gRT->SetVariable (
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ VariableSize,
+ NewVariable
+ );
+ //
+ // Shrinking variable with existing variable driver implementation shouldn't fail.
+ //
+ ASSERT_EFI_ERROR (Status);
+ }
}
if (NewVariable != NULL) {
diff --git a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c
index 0252db1..42ab3f1 100644
--- a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c
+++ b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c
@@ -562,6 +562,10 @@ FvSimpleFileSystemOpen (
// NewFileNameLength = FileNameLength + 1 + 4 = (Number of non-null character) + (file extension) + (a null character)
NewFileNameLength = FileNameLength + 1 + 4;
FileNameWithExtension = AllocatePool (NewFileNameLength * 2);
+ if (FileNameWithExtension == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
StrCpyS (FileNameWithExtension, NewFileNameLength, FileName);
StrCatS (FileNameWithExtension, NewFileNameLength, L".EFI");
diff --git a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c
index 3f96407..5d7fdaa 100644
--- a/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c
+++ b/MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemEntryPoint.c
@@ -450,7 +450,10 @@ FvSimpleFileSystemDriverStart (
// Create an instance
//
Instance = AllocateZeroPool (sizeof (FV_FILESYSTEM_INSTANCE));
- ASSERT (Instance != NULL);
+ if (Instance == NULL) {
+ ASSERT (Instance != NULL);
+ return EFI_OUT_OF_RESOURCES;
+ }
Instance->Root = NULL;
Instance->FvProtocol = FvProtocol;