From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 5C82D20359A90 for ; Wed, 22 Nov 2017 00:10:08 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2017 00:14:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="10611979" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 22 Nov 2017 00:14:23 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Nov 2017 00:14:18 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Nov 2017 00:14:18 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Wed, 22 Nov 2017 16:14:16 +0800 From: "Yao, Jiewen" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove assertion Thread-Index: AQHTYb5wKFik54JGQUyK1+AwHeWIHKMgED7A Date: Wed, 22 Nov 2017 08:14:16 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA27FF2@shsmsx102.ccr.corp.intel.com> References: <20171120051411.36284-1-ruiyu.ni@intel.com> In-Reply-To: <20171120051411.36284-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWE0YzY1NTMtNjY2OC00YjI4LThkNmMtMzFkNDJkZWEyOWUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJPWUhQM0RFWlFrTWZtclU0MXBXWk1hUlpEMVNyMGFjWEdZbzFOSEtmMVg2SmxSTlwvMVpKV3VRRUorTmtRRUIzeCJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove assertion 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: , X-List-Received-Date: Wed, 22 Nov 2017 08:10:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, November 20, 2017 1:14 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen > Subject: [PATCH] MdeModulePkg/UefiBootManagerLib: Remove assertion >=20 > EfiBootManagerStartHotkeyService() asserts when "BootOptionSupport" > variable doesn't exist. >=20 > In fact, though "BootOptionSupport" variable is set in BdsDxe > module, it's possible that the variable is deleted by > PlatformBootManagerBeforeConsole(). >=20 > The patch removes the assertion and adds code to handle the case. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Jiewen Yao > --- > MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c > index efad073880..d18ce02eb3 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c > @@ -870,13 +870,13 @@ EfiBootManagerStartHotkeyService ( > EFI_EVENT Event; > UINT32 *BootOptionSupport; >=20 > - Status =3D GetEfiGlobalVariable2 > (EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, (VOID **) > &BootOptionSupport, NULL); > - ASSERT (BootOptionSupport !=3D NULL); > - > - if ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_KEY) !=3D 0) { > - mBmHotkeySupportCount =3D ((*BootOptionSupport & > EFI_BOOT_OPTION_SUPPORT_COUNT) >> LowBitSet32 > (EFI_BOOT_OPTION_SUPPORT_COUNT)); > + GetEfiGlobalVariable2 (EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, > (VOID **) &BootOptionSupport, NULL); > + if (BootOptionSupport !=3D NULL) { > + if ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_KEY) !=3D 0) { > + mBmHotkeySupportCount =3D ((*BootOptionSupport & > EFI_BOOT_OPTION_SUPPORT_COUNT) >> LowBitSet32 > (EFI_BOOT_OPTION_SUPPORT_COUNT)); > + } > + FreePool (BootOptionSupport); > } > - FreePool (BootOptionSupport); >=20 > if (mBmHotkeySupportCount =3D=3D 0) { > DEBUG ((EFI_D_INFO, "Bds: BootOptionSupport NV variable forbids > starting the hotkey service.\n")); > -- > 2.15.0.gvfs.1.preview.4