public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: Leif Lindholm <leif@nuviainc.com>
Cc: devel@edk2.groups.io, pete@akeo.ie, awarkentin@vmware.com,
	jeremy.linton@arm.com, Samer.El-Haj-Mahmoud@arm.com
Subject: Re: [PATCH] EmbeddedPkg/NonCoherentDmaLib: avoid dereferencing bogus buffer address
Date: Wed, 17 Jun 2020 20:31:49 +0200	[thread overview]
Message-ID: <e85ac106-db50-3705-8f39-eb7d17ae03ec@arm.com> (raw)
In-Reply-To: <20200617161438.GR6739@vanye>

On 6/17/20 6:14 PM, Leif Lindholm wrote:
> On Wed, Jun 17, 2020 at 17:38:24 +0200, Ard Biesheuvel wrote:
>> The bounce buffering code in NonCoherentDmaLib copies data into the
>> bounce buffer using CopyMem(), but passes Map->HostAddress as the
>> source of the copy before it has been assigned its correct value.
> 
> Whoops.
> 
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
> 
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
> 

Thanks

Merged as 8f22a331b955bd3f8077c7fa83bafeec566d6718


>> ---
>>   EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
>> index 115345765435..9c8ef5bfb533 100644
>> --- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
>> +++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
>> @@ -225,8 +225,7 @@ DmaMap (
>>       }
>>   
>>       if (Map->Operation == MapOperationBusMasterRead) {
>> -      CopyMem (Map->BufferAddress, (VOID *)(UINTN)Map->HostAddress,
>> -        *NumberOfBytes);
>> +      CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);
>>       }
>>       mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,
>>               EfiCpuFlushTypeWriteBack);
>> -- 
>> 2.27.0
>>


  reply	other threads:[~2020-06-17 18:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 15:38 [PATCH] EmbeddedPkg/NonCoherentDmaLib: avoid dereferencing bogus buffer address Ard Biesheuvel
2020-06-17 16:14 ` Leif Lindholm
2020-06-17 18:31   ` Ard Biesheuvel [this message]
2020-06-17 16:19 ` [edk2-devel] " Andrei Warkentin

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=e85ac106-db50-3705-8f39-eb7d17ae03ec@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