summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@arm.com>2020-06-17 17:32:16 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-06-17 18:28:29 +0000
commit8f22a331b955bd3f8077c7fa83bafeec566d6718 (patch)
tree485da8aba670cf31afa12c466eaadf2fd151c2c4 /EmbeddedPkg
parent2d233af64b8f73d1b1e138b302e6344f7c2e0f4e (diff)
downloadedk2-8f22a331b955bd3f8077c7fa83bafeec566d6718.tar.gz
edk2-8f22a331b955bd3f8077c7fa83bafeec566d6718.tar.bz2
edk2-8f22a331b955bd3f8077c7fa83bafeec566d6718.zip
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.c3
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);