diff options
-rw-r--r-- | MdeModulePkg/Application/CapsuleApp/CapsuleDump.c | 23 | ||||
-rw-r--r-- | MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c | 5 |
2 files changed, 18 insertions, 10 deletions
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c index 7bef5a1378..ba2583accb 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -970,12 +970,15 @@ DumpProvisionedCapsule ( EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs;
EFI_SHELL_PROTOCOL *ShellProtocol;
- ShellProtocol = GetShellProtocol ();
-
Index = 0;
CapsuleDataPtr64 = NULL;
BootNext = NULL;
- ShellProtocol = NULL;
+
+ ShellProtocol = GetShellProtocol ();
+ if (ShellProtocol == NULL) {
+ Print (L"Get Shell Protocol Fail\n");
+ return ;
+ }
//
// Dump capsule provisioned on Memory
@@ -1002,16 +1005,16 @@ DumpProvisionedCapsule ( (VOID **) &CapsuleDataPtr64,
NULL
);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || CapsuleDataPtr64 == NULL) {
if (Index == 0) {
Print (L"No data.\n");
}
break;
- } else {
- Index++;
- Print (L"Capsule Description at 0x%08x\n", *CapsuleDataPtr64);
- DumpBlockDescriptors ((EFI_CAPSULE_BLOCK_DESCRIPTOR*) (UINTN) *CapsuleDataPtr64, DumpCapsuleInfo);
}
+
+ Index++;
+ Print (L"Capsule Description at 0x%08x\n", *CapsuleDataPtr64);
+ DumpBlockDescriptors ((EFI_CAPSULE_BLOCK_DESCRIPTOR*) (UINTN) *CapsuleDataPtr64, DumpCapsuleInfo);
}
//
@@ -1026,7 +1029,9 @@ DumpProvisionedCapsule ( (VOID **) &BootNext,
NULL
);
- if (!EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || BootNext == NULL) {
+ Print (L"Get BootNext Variable Fail. Status = %r\n", Status);
+ } else {
UnicodeSPrint (BootOptionName, sizeof (BootOptionName), L"Boot%04x", *BootNext);
Status = EfiBootManagerVariableToLoadOption (BootOptionName, &BootNextOptionEntry);
if (!EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c b/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c index 4faa863bca..f6e46cbdb1 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleOnDisk.c @@ -445,7 +445,10 @@ GetUpdateFileSystem ( (VOID **)&BootNextData,
NULL
);
- if (!EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || BootNextData == NULL) {
+ Print (L"Get Boot Next Data Fail. Status = %r\n", Status);
+ return EFI_NOT_FOUND;
+ } else {
UnicodeSPrint (BootOptionName, sizeof (BootOptionName), L"Boot%04x", *BootNextData);
Status = EfiBootManagerVariableToLoadOption (BootOptionName, &BootNextOption);
if (!EFI_ERROR (Status)) {
|