public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check
Date: Mon, 28 Aug 2017 03:17:28 +0000	[thread overview]
Message-ID: <ED077930C258884BBCB450DB737E66224A9D1F23@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1503629916-306840-1-git-send-email-dandan.bi@intel.com>

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Bi, Dandan 
Sent: Friday, August 25, 2017 10:59 AM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check

mLegacyBootOptionPrivate pointer is initialized in Constructor function with if condition check, but it's used in Destructor function directly without any check. Now add the NULL pointer check.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c
index 740c95c..a4828b7 100644
--- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c
+++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMai
+++ ntUi.c
@@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
 
 #include "LegacyBootMaintUi.h"
 
-LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate;
+LEGACY_BOOT_OPTION_CALLBACK_DATA  *mLegacyBootOptionPrivate = NULL;
 EFI_GUID  mLegacyBootOptionGuid     = LEGACY_BOOT_OPTION_FORMSET_GUID;
 CHAR16    mLegacyBootStorageName[]  = L"LegacyBootData";
 BBS_TYPE  mBbsType[] = {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN};
 BOOLEAN   mFirstEnterLegacyForm = FALSE;
 
@@ -1484,11 +1484,11 @@ LegacyBootMaintUiLibDestructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
   EFI_STATUS    Status;
 
-  if (mLegacyBootOptionPrivate->DriverHandle != NULL) {
+  if (mLegacyBootOptionPrivate != NULL && 
+ mLegacyBootOptionPrivate->DriverHandle != NULL) {
     Status = gBS->UninstallMultipleProtocolInterfaces (
                     mLegacyBootOptionPrivate->DriverHandle,
                     &gEfiDevicePathProtocolGuid,
                     &mLegacyBootOptionHiiVendorDevicePath,
                     &gEfiHiiConfigAccessProtocolGuid,
--
1.9.5.msysgit.1



      reply	other threads:[~2017-08-28  3:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  2:58 [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check Dandan Bi
2017-08-28  3:17 ` Dong, Eric [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=ED077930C258884BBCB450DB737E66224A9D1F23@shsmsx102.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