public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Wu, Hao A" <hao.a.wu@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Turner <Michael.Turner@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: Re: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery
Date: Mon, 3 Jun 2019 07:42:42 +0000	[thread overview]
Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B7E3270@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C18AEB9@SHSMSX104.ccr.corp.intel.com>



> -----Original Message-----
> From: Ni, Ray
> Sent: Monday, June 3, 2019 3:27 PM
> To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>;
> Sean Brogan <sean.brogan@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Bret Barkelew
> <Bret.Barkelew@microsoft.com>
> Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control
> PlatformRecovery
> 
> 
> 
> > -----Original Message-----
> > From: Gao, Zhichao <zhichao.gao@intel.com>
> > Sent: Monday, June 3, 2019 3:13 PM
> > To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> > <hao.a.wu@intel.com>; Zeng, Star <star.zeng@intel.com>; Gao, Liming
> > <liming.gao@intel.com>; Sean Brogan <sean.brogan@microsoft.com>;
> > Michael Turner <Michael.Turner@microsoft.com>; Bret Barkelew
> > <Bret.Barkelew@microsoft.com>
> > 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 <zhichao.gao@intel.com>; devel@edk2.groups.io
> > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> > > <hao.a.wu@intel.com>; Zeng, Star <star.zeng@intel.com>; Gao, Liming
> > > <liming.gao@intel.com>; Sean Brogan <sean.brogan@microsoft.com>;
> > > Michael Turner <Michael.Turner@microsoft.com>; Bret Barkelew
> > > <Bret.Barkelew@microsoft.com>
> > > 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 or not.
> >
> > >
> > > FilePath is NULL when memory allocation fails.
> > > So I am thinking maybe ASSERT (FilePath != NULL) is enough when
> > > EfiBootManagerInitializeLoadOption().
> >
> > Maybe it is not enough. The ASSERT only work in DEBUG build. Did I
> > take a mistake?
> 
> You are right.
> How about do a DEBUG print followed by a CpuDeadLoop() when FilePath is
> NULL?
> 
> Then all code below that point doesn't need to take care this error any more.

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.

> 
> >
> > Thanks,
> > Zhichao
> >
> > >
> > >
> > >
> > > >
> > > >    DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n"));
> > > >    PlatformBootManagerUnableToBoot ();
> > > > --
> > > > 2.21.0.windows.1


      reply	other threads:[~2019-06-03  7:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  6:43 [PATCH 0/2] Use a pcd to control Platform Recovery behavior Gao, Zhichao
2019-06-03  6:43 ` [PATCH 1/2] MdeModulePkg: Add a pcd to set the OS indications bit Gao, Zhichao
2019-06-03  6:59   ` Ni, Ray
2019-06-03  6:43 ` [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery Gao, Zhichao
2019-06-03  6:59   ` Ni, Ray
2019-06-03  7:13     ` Gao, Zhichao
2019-06-03  7:26       ` Ni, Ray
2019-06-03  7:42         ` Gao, Zhichao [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=3CE959C139B4C44DBEA1810E3AA6F9000B7E3270@SHSMSX101.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