]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
authorJeremy Linton <jeremy.linton@arm.com>
Fri, 13 Aug 2021 05:05:08 +0000 (00:05 -0500)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 17 Aug 2021 14:01:19 +0000 (14:01 +0000)
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>
EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c

index 9c8ef5bfb533b1d4c480b4c4cfd3fe50a27bd936..1aec86fffd06c8b94aabbb135169e19b81929cfd 100644 (file)
@@ -224,7 +224,7 @@ DmaMap (
       goto FreeMapInfo;\r
     }\r
 \r
-    if (Map->Operation == MapOperationBusMasterRead) {\r
+    if (Operation == MapOperationBusMasterRead) {\r
       CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);\r
     }\r
     mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,\r