From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: zhichao.gao@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Mon, 03 Jun 2019 00:42:46 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 00:42:46 -0700 X-ExtLoop1: 1 Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 03 Jun 2019 00:42:45 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 3 Jun 2019 00:42:45 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 3 Jun 2019 00:42:45 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.137]) with mapi id 14.03.0415.000; Mon, 3 Jun 2019 15:42:43 +0800 From: "Gao, Zhichao" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Wu, Hao A" , "Zeng, Star" , "Gao, Liming" , Sean Brogan , Michael Turner , Bret Barkelew Subject: Re: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery Thread-Topic: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery Thread-Index: AQHVGde/TaOcdBKQvEyVN6fg8pKL86aJfjSAgAADjPCAAAScAIAAA6Wg Date: Mon, 3 Jun 2019 07:42:42 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B7E3270@SHSMSX101.ccr.corp.intel.com> References: <20190603064358.13296-1-zhichao.gao@intel.com> <20190603064358.13296-3-zhichao.gao@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C18AD13@SHSMSX104.ccr.corp.intel.com> <3CE959C139B4C44DBEA1810E3AA6F9000B7E322A@SHSMSX101.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C18AEB9@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C18AEB9@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zhichao.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Ni, Ray > Sent: Monday, June 3, 2019 3:27 PM > To: Gao, Zhichao ; devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ; > Zeng, Star ; Gao, Liming ; > Sean Brogan ; Michael Turner > ; Bret Barkelew > > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control > PlatformRecovery >=20 >=20 >=20 > > -----Original Message----- > > From: Gao, Zhichao > > Sent: Monday, June 3, 2019 3:13 PM > > To: Ni, Ray ; devel@edk2.groups.io > > Cc: Wang, Jian J ; Wu, Hao A > > ; Zeng, Star ; Gao, Liming > > ; Sean Brogan ; > > Michael Turner ; Bret Barkelew > > > > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control > > PlatformRecovery > > > > > > > > > -----Original Message----- > > > From: Ni, Ray > > > Sent: Monday, June 3, 2019 2:59 PM > > > To: Gao, Zhichao ; devel@edk2.groups.io > > > Cc: Wang, Jian J ; Wu, Hao A > > > ; Zeng, Star ; Gao, Liming > > > ; Sean Brogan ; > > > Michael Turner ; Bret Barkelew > > > > > > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control > > > PlatformRecovery > > > > > > > + // > > > > + // When platform recovery is not enabled, still boot to > > > > + platform default > > > > file path. > > > > + // > > > > + EfiBootManagerProcessLoadOption (&PlatformDefaultBootOption)= ; > > > > + } > > > > } > > > > + EfiBootManagerFreeLoadOption (&PlatformDefaultBootOption); > > > > > > PlatformDefaultBootOption might be uninitialized if FilePath is NULL. > > > > EfiBootManagerFreeLoadOption would check the pointer before free. So > > it is safe regardless of the PlatformDefaultBootOption is initialized o= r not. > > > > > > > > FilePath is NULL when memory allocation fails. > > > So I am thinking maybe ASSERT (FilePath !=3D NULL) is enough when > > > EfiBootManagerInitializeLoadOption(). > > > > Maybe it is not enough. The ASSERT only work in DEBUG build. Did I > > take a mistake? >=20 > You are right. > How about do a DEBUG print followed by a CpuDeadLoop() when FilePath is > NULL? >=20 > Then all code below that point doesn't need to take care this error any m= ore. I am OK with that because fail to allocate memory should be a serious error= that would make the boot flow work incorrect. And putting the system into = a dead loop to indicate the failure of boot is fine. >=20 > > > > Thanks, > > Zhichao > > > > > > > > > > > > > > > > > > > DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n")); > > > > PlatformBootManagerUnableToBoot (); > > > > -- > > > > 2.21.0.windows.1