mirror of https://github.com/acidanthera/audk.git
EmbeddedPkg/NonCoherentDmaLib: avoid dereferencing bogus buffer address
The bounce buffering code in NonCoherentDmaLib copies data into the bounce buffer using CopyMem(), but passes Map->HostAddress as the source of the copy before it has been assigned its correct value. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com> Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
This commit is contained in:
parent
2d233af64b
commit
8f22a331b9
|
@ -225,8 +225,7 @@ DmaMap (
|
|||
}
|
||||
|
||||
if (Map->Operation == MapOperationBusMasterRead) {
|
||||
CopyMem (Map->BufferAddress, (VOID *)(UINTN)Map->HostAddress,
|
||||
*NumberOfBytes);
|
||||
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
|
||||
}
|
||||
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,
|
||||
EfiCpuFlushTypeWriteBack);
|
||||
|
|
Loading…
Reference in New Issue