[edk2-devel] [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

Ni, Ray ray.ni at intel.com
Mon Jun 3 07:26:52 UTC 2019



> -----Original Message-----
> From: Gao, Zhichao <zhichao.gao at intel.com>
> Sent: Monday, June 3, 2019 3:13 PM
> To: Ni, Ray <ray.ni at intel.com>; devel at edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>;
> Zeng, Star <star.zeng at intel.com>; Gao, Liming <liming.gao at intel.com>;
> Sean Brogan <sean.brogan at microsoft.com>; Michael Turner
> <Michael.Turner at microsoft.com>; Bret Barkelew
> <Bret.Barkelew at 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 at intel.com>; devel at edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A
> > <hao.a.wu at intel.com>; Zeng, Star <star.zeng at intel.com>; Gao, Liming
> > <liming.gao at intel.com>; Sean Brogan <sean.brogan at microsoft.com>;
> > Michael Turner <Michael.Turner at microsoft.com>; Bret Barkelew
> > <Bret.Barkelew at 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.

> 
> 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 (#41800): https://edk2.groups.io/g/devel/message/41800
Mute This Topic: https://groups.io/mt/31907730/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list