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

* Re: [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2021-08-16  7:10 UTC (permalink / raw)
  To: Jeremy Linton, Liming Gao (Byosoft address)
  Cc: edk2-devel-groups-io, Peter Batard, Ard Biesheuvel, Leif Lindholm,
	Andrei Warkentin, Sunny Wang, Samer El-Haj-Mahmoud

On Fri, 13 Aug 2021 at 07:05, Jeremy Linton <jeremy.linton@arm.com> wrote:
>
> 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>

Thanks for fixing this.

Liming, I am not sure what stage of the release cycle we are currently
in, but this fix should go in right away anyway. Unless any objections
are raised, I will merge it later today. I will leave it to you to
decide how this affects the stable tag release schedule.

-- 
Ard.


> ---
>  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	[flat|nested] 3+ messages in thread

* Re: [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field
  2021-08-16  7:10 ` Ard Biesheuvel
@ 2021-08-17 14:02   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2021-08-17 14:02 UTC (permalink / raw)
  To: Jeremy Linton, Liming Gao (Byosoft address)
  Cc: edk2-devel-groups-io, Peter Batard, Ard Biesheuvel, Leif Lindholm,
	Andrei Warkentin, Sunny Wang, Samer El-Haj-Mahmoud

On Mon, 16 Aug 2021 at 09:10, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Fri, 13 Aug 2021 at 07:05, Jeremy Linton <jeremy.linton@arm.com> wrote:
> >
> > 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>
>
> Thanks for fixing this.
>
> Liming, I am not sure what stage of the release cycle we are currently
> in, but this fix should go in right away anyway. Unless any objections
> are raised, I will merge it later today. I will leave it to you to
> decide how this affects the stable tag release schedule.
>

Merged as #1901

^ permalink raw reply	[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