public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ryan Harkin <ryan.harkin@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Daniil Egranov <daniil.egranov@arm.com>,
	 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH] ArmPkg/Library/ArmDmaLib: Deallocate Map buffer in case of error
Date: Tue, 1 Nov 2016 17:58:32 +0000	[thread overview]
Message-ID: <CAD0U-hKCOhOmf1zddWg51UVJpf5XMz4+UvJ8v3Mp4zFRB+6LeA@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu9Ej+oFz9vFp6FtnxdeG4jFX3y_SttMBVOUS2TLaQQYyA@mail.gmail.com>

Hi Leif,

Is this waiting for a Tested-by or something else?

Cheers,
Ryan.

On 23 September 2016 at 09:00, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 22 September 2016 at 23:37, Daniil Egranov <daniil.egranov@arm.com> wrote:
>> The patch is fixing memory leak in case of errors.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
>> ---
>>  ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
>> index d48d6ff..e0006c0 100644
>> --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
>> +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
>> @@ -90,14 +90,13 @@ DmaMap (
>>      return  EFI_OUT_OF_RESOURCES;
>>    }
>>
>> -  *Mapping = Map;
>> -
>>    if ((((UINTN)HostAddress & (gCacheAlignment - 1)) != 0) ||
>>        ((*NumberOfBytes & (gCacheAlignment - 1)) != 0)) {
>>
>>      // Get the cacheability of the region
>>      Status = gDS->GetMemorySpaceDescriptor (*DeviceAddress, &GcdDescriptor);
>>      if (EFI_ERROR(Status)) {
>> +      FreePool(Map);
>>        return Status;
>>      }
>>
>> @@ -112,6 +111,7 @@ DmaMap (
>>            "%a: Operation type 'MapOperationBusMasterCommonBuffer' is only supported\n"
>>            "on memory regions that were allocated using DmaAllocateBuffer ()\n",
>>            __FUNCTION__));
>> +        FreePool(Map);
>>          return EFI_UNSUPPORTED;
>>        }
>>
>> @@ -122,6 +122,7 @@ DmaMap (
>>        Map->DoubleBuffer  = TRUE;
>>        Status = DmaAllocateBuffer (EfiBootServicesData, EFI_SIZE_TO_PAGES (*NumberOfBytes), &Buffer);
>>        if (EFI_ERROR (Status)) {
>> +        FreePool(Map);
>>          return Status;
>>        }
>>
>> @@ -162,6 +163,8 @@ DmaMap (
>>    Map->NumberOfBytes = *NumberOfBytes;
>>    Map->Operation     = Operation;
>>
>> +  *Mapping = Map;
>> +
>>    return EFI_SUCCESS;
>>  }
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-11-01 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 22:37 [PATCH] ArmPkg/Library/ArmDmaLib: Deallocate Map buffer in case of error Daniil Egranov
2016-09-23  8:00 ` Ard Biesheuvel
2016-11-01 17:58   ` Ryan Harkin [this message]
2016-11-02 11:56     ` Ryan Harkin
2016-11-15 13:28       ` 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=CAD0U-hKCOhOmf1zddWg51UVJpf5XMz4+UvJ8v3Mp4zFRB+6LeA@mail.gmail.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