summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-19 06:46:28 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-19 06:46:28 +0000
commit6c03e3d4d36e8fb3c6eb97f973ffdbee920ca468 (patch)
tree81efbbe59b996c9707f90cc6afcdf11f7065ab9a
parentd416252072e0de7bc47d93edcdea7b116704214c (diff)
downloadedk2-6c03e3d4d36e8fb3c6eb97f973ffdbee920ca468.tar.gz
edk2-6c03e3d4d36e8fb3c6eb97f973ffdbee920ca468.tar.bz2
edk2-6c03e3d4d36e8fb3c6eb97f973ffdbee920ca468.zip
Sync patch r11932 from main trunk.
Fix a potential memory free failure bug in AtaAtapiPassThru. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@12940 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
index 50b95a6713..52cc874dc4 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
@@ -1356,6 +1356,7 @@ AtaUdmaInOut (
UINT8 RegisterValue;
EFI_ATA_DMA_PRD *PrdBaseAddr;
+ EFI_ATA_DMA_PRD *TempPrdBaseAddr;
UINTN PrdTableNum;
UINTN PrdTableSize;
EFI_PHYSICAL_ADDRESS PrdTableMapAddr;
@@ -1473,20 +1474,21 @@ AtaUdmaInOut (
// Fill the PRD table with appropriate bus master address of data buffer and data length.
//
ByteRemaining = ByteCount;
+ TempPrdBaseAddr = PrdBaseAddr;
while (ByteRemaining != 0) {
if (ByteRemaining <= 0x10000) {
- PrdBaseAddr->RegionBaseAddr = (UINT32) ((UINTN) BufferMapAddress);
- PrdBaseAddr->ByteCount = (UINT16) ByteRemaining;
- PrdBaseAddr->EndOfTable = 0x8000;
+ TempPrdBaseAddr->RegionBaseAddr = (UINT32) ((UINTN) BufferMapAddress);
+ TempPrdBaseAddr->ByteCount = (UINT16) ByteRemaining;
+ TempPrdBaseAddr->EndOfTable = 0x8000;
break;
}
- PrdBaseAddr->RegionBaseAddr = (UINT32) ((UINTN) BufferMapAddress);
- PrdBaseAddr->ByteCount = (UINT16) 0x0;
+ TempPrdBaseAddr->RegionBaseAddr = (UINT32) ((UINTN) BufferMapAddress);
+ TempPrdBaseAddr->ByteCount = (UINT16) 0x0;
ByteRemaining -= 0x10000;
BufferMapAddress += 0x10000;
- PrdBaseAddr++;
+ TempPrdBaseAddr++;
}
//