From nobody Wed May 1 15:09:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1503629943044906.5808565436042; Thu, 24 Aug 2017 19:59:03 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5F99421E47D48; Thu, 24 Aug 2017 19:56:24 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7383321DFC897 for ; Thu, 24 Aug 2017 19:56:22 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2017 19:58:57 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga001.fm.intel.com with ESMTP; 24 Aug 2017 19:58:56 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,423,1498546800"; d="scan'208";a="1187956671" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 25 Aug 2017 10:58:36 +0800 Message-Id: <1503629916-306840-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [patch] IntelFrameworkModulePkg/LegacyBootMaintUiLib: Add NULL pointer check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong --- .../Library/LegacyBootMaintUiLib/LegacyBootMaintUi.c | 4 = ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBoo= tMaintUi.c b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBoo= tMaintUi.c index 740c95c..a4828b7 100644 --- a/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintU= i.c +++ b/IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintU= i.c @@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. **/ =20 =20 #include "LegacyBootMaintUi.h" =20 -LEGACY_BOOT_OPTION_CALLBACK_DATA *mLegacyBootOptionPrivate; +LEGACY_BOOT_OPTION_CALLBACK_DATA *mLegacyBootOptionPrivate =3D NULL; EFI_GUID mLegacyBootOptionGuid =3D LEGACY_BOOT_OPTION_FORMSET_GUID; CHAR16 mLegacyBootStorageName[] =3D L"LegacyBootData"; BBS_TYPE mBbsType[] =3D {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_N= ETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN}; BOOLEAN mFirstEnterLegacyForm =3D FALSE; =20 @@ -1484,11 +1484,11 @@ LegacyBootMaintUiLibDestructor ( IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; =20 - if (mLegacyBootOptionPrivate->DriverHandle !=3D NULL) { + if (mLegacyBootOptionPrivate !=3D NULL && mLegacyBootOptionPrivate->Driv= erHandle !=3D NULL) { Status =3D gBS->UninstallMultipleProtocolInterfaces ( mLegacyBootOptionPrivate->DriverHandle, &gEfiDevicePathProtocolGuid, &mLegacyBootOptionHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel