diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-24 00:30:53 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-24 00:30:53 +0000 |
commit | 6f716497dee8dcc8eea249e3136793678cf6ad59 (patch) | |
tree | 40e9163667285c97b0d214edf20a8ce95a1455f8 | |
parent | d9b834afbf67ad45b5cbf339e957efe441978218 (diff) | |
download | edk2-platforms-6f716497dee8dcc8eea249e3136793678cf6ad59.tar.xz |
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
-rw-r--r-- | OptionRomPkg/CirrusLogic5430Dxe/Edid.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OptionRomPkg/CirrusLogic5430Dxe/Edid.c b/OptionRomPkg/CirrusLogic5430Dxe/Edid.c index 76a74ccf5e..73999e3f15 100644 --- a/OptionRomPkg/CirrusLogic5430Dxe/Edid.c +++ b/OptionRomPkg/CirrusLogic5430Dxe/Edid.c @@ -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:
|