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.93; helo=mga11.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 6EE2F2118D93C for ; Wed, 7 Nov 2018 16:29:51 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 16:29:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,477,1534834800"; d="scan'208";a="84800976" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 07 Nov 2018 16:29:51 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 16:29:50 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 16:29:50 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.102]) with mapi id 14.03.0415.000; Thu, 8 Nov 2018 08:29:48 +0800 From: "Gao, Liming" To: Jeff Brasen , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool() Thread-Index: AQHUcJfznwFiF9PKqkm9Pp1HsO9WFqVFEv7w Date: Thu, 8 Nov 2018 00:29:47 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E366271@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQ2OWZlZWQtNThjNi00OTA4LTg4YjEtZGM4NzEyMTc4YTUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTmtkN1paTEZWSnB4ZXRXdWNUMTVKTVRjdndUN2JRRmJESUEzUVRqQ3BRalVWbzVmczBicVprZE9MQmR6NnRXOCJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] 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: Thu, 08 Nov 2018 00:29:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc to the package maintainers.=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Je= ff Brasen > Sent: Wednesday, October 31, 2018 5:31 AM > To: edk2-devel@lists.01.org > Cc: Jeff Brasen > Subject: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added A= llocateZeroPool() >=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/MemoryAllocatio= nLib.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 EfiBoot= ServicesData, 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