]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression
[mirror_edk2.git] / MdeModulePkg / Library / PeiReportStatusCodeLib / ReportStatusCodeLib.c
index 42b1ddb7581ea3f16c59769de71e3d352b5fe19d..d41d4e981df326342fe954ba3f723c48a0513b61 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Instance of Report Status Code Library for PEI Phase.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -458,7 +458,7 @@ ReportStatusCodeEx (
   )\r
 {\r
   EFI_STATUS_CODE_DATA  *StatusCodeData;\r
-  UINT64                Buffer[MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)];\r
+  UINT64                Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];\r
 \r
   //\r
   // If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
@@ -470,11 +470,16 @@ ReportStatusCodeEx (
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
   if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
+    //\r
+    // The local variable Buffer not large enough to hold the extended data associated\r
+    // with the status code being reported.\r
+    //\r
+    DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  StatusCodeData = (EFI_STATUS_CODE_DATA  *)Buffer;\r
-  StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r
-  StatusCodeData->Size = (UINT16)ExtendedDataSize;\r
+  StatusCodeData = (EFI_STATUS_CODE_DATA  *) Buffer;\r
+  StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);\r
+  StatusCodeData->Size = (UINT16) ExtendedDataSize;\r
   if (ExtendedDataGuid == NULL) {\r
     ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;\r
   }\r