From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check
Date: Fri, 25 Aug 2017 10:58:36 +0800 [thread overview]
Message-ID: <1503629916-306840-1-git-send-email-dandan.bi@intel.com> (raw)
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/LegacyBootMaintUi.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
next reply other threads:[~2017-08-25 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 2:58 Dandan Bi [this message]
2017-08-28 3:17 ` [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check Dong, Eric
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=1503629916-306840-1-git-send-email-dandan.bi@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