summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Linton <jeremy.linton@arm.com>2021-08-13 00:05:08 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-08-17 14:01:19 +0000
commitef56f55d19e1b0b4ba6f9b28d73165c7f0a4627c (patch)
tree15a4d69210d9086bb187f4a0628b1dc59a5db69e
parent6fdd1c13a734609aff68d37e606e995d673d9aeb (diff)
downloadedk2-ef56f55d19e1b0b4ba6f9b28d73165c7f0a4627c.tar.gz
edk2-ef56f55d19e1b0b4ba6f9b28d73165c7f0a4627c.tar.bz2
edk2-ef56f55d19e1b0b4ba6f9b28d73165c7f0a4627c.zip
EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
Map->Operation is used to select whether a DMA region that is being bounced has the source buffer copied to it. Except Map->Operation isn't yet set, so the behavior is somewhat random. Instead use the passed in Operation parameter. Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
index 9c8ef5bfb5..1aec86fffd 100644
--- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
+++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
@@ -224,7 +224,7 @@ DmaMap (
goto FreeMapInfo;
}
- if (Map->Operation == MapOperationBusMasterRead) {
+ if (Operation == MapOperationBusMasterRead) {
CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
}
mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,