MdeModulePkg/CapsuleApp: Fix potential NULL pointer dereference issue
To avoid potential NULL pointer dereference issue. Initialize them at the beginning of the function. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -151,9 +151,14 @@ DumpAllEfiSysPartition (
|
||||
UINTN NumberEfiSystemPartitions;
|
||||
EFI_SHELL_PROTOCOL *ShellProtocol;
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
NumberEfiSystemPartitions = 0;
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
Print (L"Get Shell Protocol Fail\n");;
|
||||
return ;
|
||||
}
|
||||
|
||||
Print (L"EFI System Partition list:\n");
|
||||
|
||||
gBS->LocateHandleBuffer (
|
||||
@@ -421,7 +426,13 @@ GetUpdateFileSystem (
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION NewOption;
|
||||
|
||||
MappedDevicePath = NULL;
|
||||
BootOptionBuffer = NULL;
|
||||
|
||||
ShellProtocol = GetShellProtocol ();
|
||||
if (ShellProtocol == NULL) {
|
||||
Print (L"Get Shell Protocol Fail\n");;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// 1. If Fs is not assigned and there are capsule provisioned before,
|
||||
@@ -468,7 +479,9 @@ GetUpdateFileSystem (
|
||||
// 2. Get EFI system partition form boot options.
|
||||
//
|
||||
BootOptionBuffer = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
|
||||
if (BootOptionCount == 0 && Map == NULL) {
|
||||
if ( (BootOptionBuffer == NULL) ||
|
||||
(BootOptionCount == 0 && Map == NULL)
|
||||
) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user