From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 01BAF21184E66 for ; Tue, 30 Oct 2018 15:57:47 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 15:57:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,446,1534834800"; d="scan'208";a="275823513" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 30 Oct 2018 15:57:47 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 15:57:46 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.186]) by fmsmsx123.amr.corp.intel.com ([169.254.7.141]) with mapi id 14.03.0415.000; Tue, 30 Oct 2018 15:57:46 -0700 From: "Carsey, Jaben" To: Jeff Brasen , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool() Thread-Index: AQHUcJfyG40C7nU2qkawvR021+I4oqU4ZrUQ Date: Tue, 30 Oct 2018 22:57:46 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2U0YTQ5ZWMtMDU0ZS00MWNlLTkxNWQtOGFhODA3MmQ5ZDRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoia1ZPVzlxR1NKZnpcL0RxbnduQU1JTXhnNUxhSUdSdHA3UnlwY092UGVcL2hBMkFCeXNpSlRucEZjY2pHTDlkdE9PIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 22:57:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Code looks good. Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jeff Brasen > Sent: Tuesday, October 30, 2018 2:31 PM > To: edk2-devel@lists.01.org > Cc: Jeff Brasen > Subject: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: > Added AllocateZeroPool() >=20 > This function is exposed by the MemoryAllocationLib header. > An AllocateZeroPool() function has been added to fix modules depending on > this library and this function. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jeff Brasen > --- > .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32 > ++++++++++++++++++++++ > 1 file changed, 32 insertions(+) >=20 > diff --git > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > index 0e75e23..f93f9cf 100644 > --- > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > +++ > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > @@ -16,6 +16,7 @@ > #include >=20 > #include > +#include > #include > #include >=20 > @@ -195,6 +196,37 @@ AllocatePool ( > } >=20 > /** > + Allocates and zeros a buffer of type EfiBootServicesData. > + > + Allocates the number bytes specified by AllocationSize of type > EfiBootServicesData, clears the > + buffer with zeros, and returns a pointer to the allocated buffer. If > AllocationSize is 0, then a > + valid buffer of 0 size is returned. If there is not enough memory rem= aining > to satisfy the > + request, then NULL is returned. > + > + @param AllocationSize The number of bytes to allocate and zero= . > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateZeroPool ( > + IN UINTN AllocationSize > + ) > +{ > + VOID *Buffer; > + > + Buffer =3D AllocatePool (AllocationSize); > + if (NULL =3D=3D Buffer) { > + return NULL; > + } > + > + SetMem (Buffer, AllocationSize, 0); > + > + return Buffer; > +} > + > +/** > Frees a buffer that was previously allocated with one of the pool allo= cation > functions in the > Memory Allocation Library. >=20 > -- > 2.7.4 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel