From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH 2/2] MdeModulePkg/CapsuleLib: Free the buffer returned by GetVariable2 API
Date: Fri, 10 Mar 2017 07:02:18 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931C7B565@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A901B2E@shsmsx102.ccr.corp.intel.com>
> -----Original Message-----
> From: Yao, Jiewen
> Sent: Friday, March 10, 2017 2:17 PM
> To: Wu, Hao A; edk2-devel@lists.01.org
> Subject: RE: [PATCH 2/2] MdeModulePkg/CapsuleLib: Free the buffer returned
> by GetVariable2 API
>
> According to GetVariable2() API, there is no guarantee that Data will be NULL,
> if error is returned.
>
> I suggest we use status check instead of data pointer check.
>
Yes, you are right. I will send out a V2 version of the series.
Best Regards,
Hao Wu
>
> /**
> Returns the status whether get the variable success. The function retrieves
> variable through the UEFI Runtime Service GetVariable(). The
> returned buffer is allocated using AllocatePool(). The caller is responsible
> for freeing this buffer with FreePool().
>
> If Name is NULL, then ASSERT().
> If Guid is NULL, then ASSERT().
> If Value is NULL, then ASSERT().
>
> @param[in] Name The pointer to a Null-terminated Unicode string.
> @param[in] Guid The pointer to an EFI_GUID structure
> @param[out] Value The buffer point saved the variable info.
> @param[out] Size The buffer size of the variable.
>
> @return EFI_OUT_OF_RESOURCES Allocate buffer failed.
> @return EFI_SUCCESS Find the specified variable.
> @return Others Errors Return errors from call to gRT->GetVariable.
>
> **/
>
>
>
> > -----Original Message-----
> > From: Wu, Hao A
> > Sent: Friday, March 10, 2017 2:07 PM
> > To: edk2-devel@lists.01.org
> > Cc: Wu, Hao A <hao.a.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> > Subject: [PATCH 2/2] MdeModulePkg/CapsuleLib: Free the buffer returned by
> > GetVariable2 API
> >
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> > ---
> > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git
> a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c
> > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c
> > index fc0f8698a9..191a432369 100644
> > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c
> > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c
> > @@ -343,6 +343,9 @@ InitCapsuleLastVariable (
> > NULL
> > );
> > }
> > + if (CapsuleResult != NULL) {
> > + FreePool (CapsuleResult);
> > + }
> > }
> >
> > // Lock it in normal boot path per UEFI spec.
> > --
> > 2.12.0.windows.1
prev parent reply other threads:[~2017-03-10 7:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 6:06 [PATCH 0/2] MdeModulePkg/CapsuleLib: Code refinements Hao Wu
2017-03-10 6:06 ` [PATCH 1/2] MdeModulePkg/CapsuleLib: Add lib destructors to handle unclosed events Hao Wu
2017-03-10 6:13 ` Yao, Jiewen
2017-03-10 6:07 ` [PATCH 2/2] MdeModulePkg/CapsuleLib: Free the buffer returned by GetVariable2 API Hao Wu
2017-03-10 6:16 ` Yao, Jiewen
2017-03-10 7:02 ` Wu, Hao A [this message]
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=B80AF82E9BFB8E4FBD8C89DA810C6A0931C7B565@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