From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 051D981CC4 for ; Tue, 1 Nov 2016 10:58:34 -0700 (PDT) Received: by mail-lf0-x232.google.com with SMTP id f134so126975011lfg.2 for ; Tue, 01 Nov 2016 10:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KqaU2ADURZhFKuceymsIAMhciJkiMBA6sboRxVgAk5U=; b=LhySMWFeE2guFKyGePbs2XfNu8DC4uxk+rhW4ITxRZOBT5SRH2n9sO+bjySciPP+jI 2WSnE+RYiZS01LF0SF8EI+8NaqvN83vQoZRci8gRsIhCUd9bZ26PG7aWhYeB3BV3JBwD bsL0BFkAzAH0Wxb6hSQeQUKqj+0t++H7aQZk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KqaU2ADURZhFKuceymsIAMhciJkiMBA6sboRxVgAk5U=; b=lLom2ht9E0f9eGxxrTs623ccqy+0A7If3kv3JaBwkaQKImVGOe6+o7SwGt7OlNUUk3 1HYrpNILgPeli2FHJSkBKDQ5bYOtlD4brQmttwWJswOOjZXunn/xd/HEvvWe9N8SrJI/ uAxjiiCvDh2+OAc+v4AQiZkn7h0UeOl1jAHO7wXCC8qRLhRRJY0ovV9MFK7EnH4dy5/d bOt/KJSZKAd0trUQSMAXWEelIB1YlPVfxMuX0DoFUxeYOlQ/CC9JGSyG62B2ab+DiGNh MEpcq+0QytWp0K8q7/g6rpL3oEqkzz+vPEMPKg3BGlQOsuhmJ1biW58ccveYP8iQEcyJ MNBw== X-Gm-Message-State: ABUngvez2rXXhzuLQcsiLca3NTldltkgy/AmtyNJKC5W8//GJreYf6RVNwaJL+yG5C02vQvIBXss5axXyQ/2+xLx X-Received: by 10.25.153.149 with SMTP id b143mr22563455lfe.150.1478023113565; Tue, 01 Nov 2016 10:58:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.17.209 with HTTP; Tue, 1 Nov 2016 10:58:32 -0700 (PDT) In-Reply-To: References: <1474583868-41777-1-git-send-email-daniil.egranov@arm.com> From: Ryan Harkin Date: Tue, 1 Nov 2016 17:58:32 +0000 Message-ID: To: Ard Biesheuvel Cc: Daniil Egranov , "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH] ArmPkg/Library/ArmDmaLib: Deallocate Map buffer in case of error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2016 17:58:34 -0000 Content-Type: text/plain; charset=UTF-8 Hi Leif, Is this waiting for a Tested-by or something else? Cheers, Ryan. On 23 September 2016 at 09:00, Ard Biesheuvel wrote: > On 22 September 2016 at 23:37, Daniil Egranov wrote: >> The patch is fixing memory leak in case of errors. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Daniil Egranov > > Reviewed-by: Ard Biesheuvel > >> --- >> 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