mirror of https://github.com/acidanthera/audk.git
Resolve a bug where the initial ReadEdidData 'for' loop would loop
infinitely, since the Index variable was declared as UINT8, and 'EDID_BLOCK_SIZE * 2' is 256. In the EFI_SUCCESS return path of CirrusLogic5430VideoModeSetup, check that 'EdidOverrideDataBlock' has been allocated before attempting to free this memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6688 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d9b834afbf
commit
6f716497de
|
@ -112,7 +112,7 @@ ReadEdidData (
|
|||
UINTN *EdidSize
|
||||
)
|
||||
{
|
||||
UINT8 Index;
|
||||
UINTN Index;
|
||||
UINT8 EdidData[EDID_BLOCK_SIZE * 2];
|
||||
UINT8 *ValidEdid;
|
||||
UINT64 Signature;
|
||||
|
@ -397,7 +397,7 @@ CirrusLogic5430VideoModeSetup (
|
|||
// If EDID Override data doesn't exist or EFI_EDID_OVERRIDE_DONT_OVERRIDE returned,
|
||||
// read EDID information through I2C Bus
|
||||
//
|
||||
if (ReadEdidData (Private, &EdidDiscoveredDataBlock, &EdidDiscoveredDataSize) == EFI_SUCCESS) {;
|
||||
if (ReadEdidData (Private, &EdidDiscoveredDataBlock, &EdidDiscoveredDataSize) == EFI_SUCCESS) {
|
||||
Private->EdidDiscovered.SizeOfEdid = (UINT32) EdidDiscoveredDataSize;
|
||||
Private->EdidDiscovered.Edid = (UINT8 *) AllocateCopyPool (
|
||||
EdidDiscoveredDataSize,
|
||||
|
@ -509,7 +509,10 @@ CirrusLogic5430VideoModeSetup (
|
|||
Private->MaxMode = CIRRUS_LOGIC_5430_MODE_COUNT;
|
||||
}
|
||||
|
||||
FreePool (EdidOverrideDataBlock);
|
||||
if (EdidOverrideDataBlock != NULL) {
|
||||
FreePool (EdidOverrideDataBlock);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
|
|
Loading…
Reference in New Issue