MdePkg DxeServicesLib: Handle potential NULL FvHandle
authorStar Zeng <star.zeng@intel.com>
Fri, 5 May 2017 08:11:57 +0000 (16:11 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 8 May 2017 00:57:03 +0000 (08:57 +0800)
commitd7b96017ccf5922b798f496fbcdcac4067d04c6d
tree47c4423d6aae71bd2f74f2e575ccd6c73509be1a
parent97cdb33b575a80ca5c20ad862331f3c6d9415575
MdePkg DxeServicesLib: Handle potential NULL FvHandle

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=514

The FvHandle input to InternalGetSectionFromFv() may be NULL,
then ASSERT will appear. It is because the LoadedImage->DeviceHandle
returned from InternalImageHandleToFvHandle() may be NULL.
For example for DxeCore, there is LoadedImage protocol installed
for it, but the LoadedImage->DeviceHandle could not be initialized
before the FV2 (contain DxeCore) protocol is installed.

This patch is to update InternalGetSectionFromFv() to return
EFI_NOT_FOUND directly for NULL FvHandle.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/DxeServicesLib/DxeServicesLib.c