]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg S3Resume2Pei: Report status code when allocate memory is failed
authorStar Zeng <star.zeng@intel.com>
Thu, 30 Jun 2016 07:17:58 +0000 (15:17 +0800)
committerStar Zeng <star.zeng@intel.com>
Sat, 2 Jul 2016 04:22:55 +0000 (12:22 +0800)
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c

index a79fc59bdfa6240a13e5157aaa8265a213b8c11d..0ccf3a42b5ff80c1138dc156451def1594e9b7c9 100644 (file)
@@ -4,7 +4,7 @@
   This module will excute the boot script saved during last boot and after that,\r
   control is passed to OS waking up handler.\r
 \r
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -822,7 +822,13 @@ S3ResumeExecuteBootScript (
     // Make sure the newly allcated IDT align with 16-bytes\r
     // \r
     IdtBuffer = AllocatePages (EFI_SIZE_TO_PAGES((IdtDescriptor->Limit + 1) + 16));\r
-    ASSERT (IdtBuffer != NULL);\r
+    if (IdtBuffer == NULL) {\r
+      REPORT_STATUS_CODE (\r
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)\r
+        );\r
+      ASSERT (FALSE);\r
+    }\r
     //\r
     // Additional 16 bytes allocated to save IA32 IDT descriptor and Pei Service Table Pointer\r
     // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code\r
@@ -852,7 +858,13 @@ S3ResumeExecuteBootScript (
   // Prepare data for return back\r
   //\r
   PeiS3ResumeState = AllocatePool (sizeof(*PeiS3ResumeState));\r
-  ASSERT (PeiS3ResumeState != NULL);\r
+  if (PeiS3ResumeState == NULL) {\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+      (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)\r
+      );\r
+    ASSERT (FALSE);\r
+  }\r
   DEBUG (( EFI_D_ERROR, "PeiS3ResumeState - %x\r\n", PeiS3ResumeState));\r
   PeiS3ResumeState->ReturnCs           = 0x10;\r
   PeiS3ResumeState->ReturnEntryPoint   = (EFI_PHYSICAL_ADDRESS)(UINTN)S3ResumeBootOs;\r