> -----Original Message-----
> From: Ni, Ray
> Sent: Monday, June 3, 2019 3:27 PM
> To: Gao, Zhichao <zhichao....@intel.com>; devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.w...@intel.com>; Wu, Hao A <hao.a...@intel.com>;
> Zeng, Star <star.z...@intel.com>; Gao, Liming <liming....@intel.com>;
> Sean Brogan <sean.bro...@microsoft.com>; Michael Turner
> <michael.tur...@microsoft.com>; Bret Barkelew
> <bret.barke...@microsoft.com>
> Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control
> PlatformRecovery
>
>
>
> > -----Original Message-----
> > From: Gao, Zhichao <zhichao....@intel.com>
> > Sent: Monday, June 3, 2019 3:13 PM
> > To: Ni, Ray <ray...@intel.com>; devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.w...@intel.com>; Wu, Hao A
> > <hao.a...@intel.com>; Zeng, Star <star.z...@intel.com>; Gao, Liming
> > <liming....@intel.com>; Sean Brogan <sean.bro...@microsoft.com>;
> > Michael Turner <michael.tur...@microsoft.com>; Bret Barkelew
> > <bret.barke...@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....@intel.com>; devel@edk2.groups.io
> > > Cc: Wang, Jian J <jian.j.w...@intel.com>; Wu, Hao A
> > > <hao.a...@intel.com>; Zeng, Star <star.z...@intel.com>; Gao, Liming
> > > <liming....@intel.com>; Sean Brogan <sean.bro...@microsoft.com>;
> > > Michael Turner <michael.tur...@microsoft.com>; Bret Barkelew
> > > <bret.barke...@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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#41801): https://edk2.groups.io/g/devel/message/41801
Mute This Topic: https://groups.io/mt/31907730/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-