1. Rollback the changing on replacing MAX_EXTENDED_DATA_SIZE by EFI_STATUS_CODE_DATA_MAX_SIZE,

use MAX_EXTENDED_DATA_SIZE as before.
2. Use DEBUG error message instead of ASSERT(FASLE) when extended data is too large
3. Expand 1 for buffer array size to avoid potential issue.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11083 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2010-11-23 07:50:31 +00:00
parent da70d02589
commit 7b78853921
2 changed files with 17 additions and 6 deletions

View File

@ -23,6 +23,11 @@
#include <Library/OemHookStatusCodeLib.h>
#include <Library/PcdLib.h>
//
// Define the maximum extended data size that is supported in the PEI phase
//
#define MAX_EXTENDED_DATA_SIZE 0x200
/**
Internal worker function that reports a status code through the PEI Status Code Service or
OEM Hook Status Code Library.
@ -453,7 +458,7 @@ ReportStatusCodeEx (
)
{
EFI_STATUS_CODE_DATA *StatusCodeData;
UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];
UINT64 Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];
//
// If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
@ -464,12 +469,12 @@ ReportStatusCodeEx (
//
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
//
// The local variable Buffer not large enough to hold the extended data associated
// with the status code being reported.
//
ASSERT (FALSE);
DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));
return EFI_OUT_OF_RESOURCES;
}
StatusCodeData = (EFI_STATUS_CODE_DATA *) Buffer;