public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: pete@akeo.ie, ardb+tianocore@kernel.org, leif@nuviainc.com,
	awarkentin@vmware.com, Sunny.Wang@arm.com,
	samer.el-haj-mahmoud@arm.com,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
Date: Fri, 13 Aug 2021 00:05:08 -0500	[thread overview]
Message-ID: <20210813050508.28232-1-jeremy.linton@arm.com> (raw)

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


             reply	other threads:[~2021-08-13  5:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  5:05 Jeremy Linton [this message]
2021-08-16  7:10 ` [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field Ard Biesheuvel
2021-08-17 14:02   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210813050508.28232-1-jeremy.linton@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox