diff options
author | Ard Biesheuvel <ard.biesheuvel@arm.com> | 2020-06-17 17:32:16 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-06-17 18:28:29 +0000 |
commit | 8f22a331b955bd3f8077c7fa83bafeec566d6718 (patch) | |
tree | 485da8aba670cf31afa12c466eaadf2fd151c2c4 /EmbeddedPkg | |
parent | 2d233af64b8f73d1b1e138b302e6344f7c2e0f4e (diff) | |
download | edk2-8f22a331b955bd3f8077c7fa83bafeec566d6718.tar.gz |
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>
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r-- | EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c index 1153457654..9c8ef5bfb5 100644 --- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c +++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c @@ -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);
|