public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
@ 2021-08-13  5:05 Jeremy Linton
  2021-08-16  7:10 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Linton @ 2021-08-13  5:05 UTC (permalink / raw)
  To: devel
  Cc: pete, ardb+tianocore, leif, awarkentin, Sunny.Wang,
	samer.el-haj-mahmoud, Jeremy Linton

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>
---
 EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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,
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-17 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-13  5:05 [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field Jeremy Linton
2021-08-16  7:10 ` Ard Biesheuvel
2021-08-17 14:02   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox