public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: Jeff Brasen <jbrasen@nvidia.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()
Date: Tue, 30 Oct 2018 22:57:46 +0000	[thread overview]
Message-ID: <CB6E33457884FA40993F35157061515CA4193A2F@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <a5bace61599e715d36d6a89354331ddce89cbe93.1540934763.git.jbrasen@nvidia.com>

Code looks good.
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----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 <jbrasen@nvidia.com>
> Subject: [edk2] [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib:
> Added AllocateZeroPool()
> 
> This function is exposed by the MemoryAllocationLib header.
> An AllocateZeroPool() function has been added to fix modules depending on
> this library and this function.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
>  .../PrePiMemoryAllocationLib/MemoryAllocationLib.c | 32
> ++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> 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 <PiPei.h>
> 
>  #include <Library/BaseLib.h>
> +#include <Library/BaseMemoryLib.h>
>  #include <Library/PrePiLib.h>
>  #include <Library/DebugLib.h>
> 
> @@ -195,6 +196,37 @@ AllocatePool (
>  }
> 
>  /**
> +  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 remaining
> 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 = AllocatePool (AllocationSize);
> +  if (NULL == Buffer) {
> +    return NULL;
> +  }
> +
> +  SetMem (Buffer, AllocationSize, 0);
> +
> +  return Buffer;
> +}
> +
> +/**
>    Frees a buffer that was previously allocated with one of the pool allocation
> functions in the
>    Memory Allocation Library.
> 
> --
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-10-30 22:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 21:30 [PATCH 0/2] SortLib for UEFI SEC Jeff Brasen
2018-10-30 21:30 ` [PATCH 1/2] EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool() Jeff Brasen
2018-10-30 22:57   ` Carsey, Jaben [this message]
2018-11-08  0:29   ` Gao, Liming
2018-11-08 11:13   ` Ard Biesheuvel
2018-11-08 16:52     ` Jeff Brasen
2018-10-30 21:30 ` [PATCH 2/2] MdeModulePkg/BaseSortLib: Enable for all module types Jeff Brasen
2018-10-30 22:57   ` Carsey, Jaben
2018-10-31  8:56   ` Ni, Ruiyu
2018-11-01  6:25     ` Jeff Brasen
2018-11-01 13:31       ` Gao, Liming
2018-11-02  4:59         ` Zeng, Star
2018-11-02  7:45           ` Gao, Liming

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=CB6E33457884FA40993F35157061515CA4193A2F@FMSMSX103.amr.corp.intel.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