public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Gao, Zhichao" <zhichao.gao@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] ShellPkg/UefiShellLib: Set input pointer parameter to null if failure
Date: Thu, 27 Jun 2019 02:13:23 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C1F24D9@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <3CE959C139B4C44DBEA1810E3AA6F9000B7F712B@SHSMSX101.ccr.corp.intel.com>

 Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Wednesday, June 12, 2019 2:14 PM
> To: devel@edk2.groups.io
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Carsey, Jaben
> <jaben.carsey@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Sean Brogan <sean.brogan@microsoft.com>;
> Michael Turner <Michael.Turner@microsoft.com>
> Subject: [edk2-devel] [PATCH] ShellPkg/UefiShellLib: Set input pointer
> parameter to null if failure
> 
> From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1906
> 
> While failed to allocate memory to save the response, set the input/output
> parameter 'Response'(VOID **) to NULL to indicate the failure not only
> depend on the returned status.
> 
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 430b20e127..5be530092e 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -3366,6 +3366,9 @@ ShellPromptForResponse (
>    if (Type != ShellPromptResponseTypeFreeform) {
>      Resp =
> (SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESP
> ONSE));
>      if (Resp == NULL) {
> +      if (Response != NULL) {
> +        *Response = NULL;
> +      }
>        return (EFI_OUT_OF_RESOURCES);
>      }
>    }
> @@ -3568,6 +3571,8 @@ ShellPromptForResponse (
>        *Response = Resp;
>      } else if (Buffer != NULL) {
>        *Response = Buffer;
> +    } else {
> +      *Response = NULL;
>      }
>    } else {
>      if (Resp != NULL) {
> --
> 2.21.0.windows.1
> 
> 
> 


           reply	other threads:[~2019-06-27  2:13 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <3CE959C139B4C44DBEA1810E3AA6F9000B7F712B@SHSMSX101.ccr.corp.intel.com>]

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=734D49CCEBEEF84792F5B80ED585239D5C1F24D9@SHSMSX104.ccr.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