diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-16 09:27:49 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-10-16 09:27:49 +0000 |
commit | 3d267c70b2f69118fe06fcec753fd62a049669eb (patch) | |
tree | 5781851cac00546d6a6294c67fd6c4299075cf01 /MdeModulePkg/Bus/Ata/AtaBusDxe | |
parent | fe8a16e52b943e56df94e25d6344ec4ee7e45723 (diff) | |
download | edk2-platforms-3d267c70b2f69118fe06fcec753fd62a049669eb.tar.xz |
Fix code potential errors.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Tian, Feng <feng.tian@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13852 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Ata/AtaBusDxe')
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c | 1 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c index 625ba1b5b1..51687fe0d3 100644 --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.c @@ -464,6 +464,7 @@ UnregisterAtaDevice ( if (BlockIo != NULL) {
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
} else {
+ ASSERT (BlockIo2 != NULL);
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (BlockIo2);
}
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c index 0045cc0d91..b50792438b 100644 --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c @@ -133,6 +133,10 @@ AtaDevicePassThru ( if (TaskPacket != NULL) {
Packet = TaskPacket;
Packet->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
+ if (Packet->Asb == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
CopyMem (Packet->Asb, AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
Packet->Acb = AllocateCopyPool (sizeof (EFI_ATA_COMMAND_BLOCK), &AtaDevice->Acb);
} else {
@@ -939,6 +943,10 @@ TrustTransferAtaDevice ( AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
if ((AtaPassThru->Mode->IoAlign > 1) && !IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
NewBuffer = AllocateAlignedBuffer (AtaDevice, TransferLength);
+ if (NewBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
CopyMem (NewBuffer, Buffer, TransferLength);
FreePool (Buffer);
Buffer = NewBuffer;
|