> -----Original Message----- > From: Leif Lindholm [mailto:leif.lindh...@linaro.org] > Sent: Monday, March 18, 2019 8:43 PM > To: Ming Huang > Cc: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; Dong, > Eric; Ni, Ray; dann.fraz...@canonical.com; ard.biesheu...@linaro.org; Kinney, > Michael D; Gao, Liming; wanghuiqi...@huawei.com; > huangmin...@huawei.com; zhangjinso...@huawei.com; > huangda...@hisilicon.com; wai...@126.com; Wang, Jian J; Wu, Hao A; Ni, > Ray > Subject: Re: [MdeModulePkg/Library v1 1/1] > MdeModulePkg/UefiBootManangerLib: Fix exception issue > > +MdeModulePkg maintainers (you added MdePkg maintainers to cc) > > This looks like an improvement to me. > > Am I correct in guessing this behaviour refers to some specific corner > case of a USB CDROM emulated from a BMC? > > On Mon, Feb 25, 2019 at 05:10:52PM +0800, Ming Huang wrote: > > The system environment: virtual-CDROM(USB interface) via BMC, insert a > > iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM > > to first boot option. > > With release version bios, disconnecting CDROM when boot to > > "1 seconds left, Press Esc or F2 to enter Setup" > > then system will get a exception. > > > > The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be > uninstalled > > in this situation after print some transfer error. The status will be > > invalid parameter. This line will get a exception for BlockIo not point
Do you mean 'EFI_INVALID_PARAMETER' is returned from: Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo); If so, my guess is that 'Handle' is NULL at this point. An improvement can be adding a previous check for 'Status' after the ASSERT at: Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle); ASSERT_EFI_ERROR (Status); And leave: Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo); ASSERT_EFI_ERROR (Status); unchanged. Best Regards, Hao Wu > > to right address: > > AllocatePool (BlockIo->Media->BlockSize) > > So, here need to judge the status not using ASSERT_EFI_ERROR. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Ming Huang <ming.hu...@linaro.org> > > --- > > MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > index d5957db610d9..c2f1c651b02f 100644 > > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > @@ -1068,7 +1068,9 @@ BmExpandMediaDevicePath ( > > // Block IO read/write will success. > > // > > Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID > **) &BlockIo); > > - ASSERT_EFI_ERROR (Status); > > + if (EFI_ERROR (Status)) { > > It would still be worth including an ASSERT here, to let DEBUG builds > report on point of failure rather than several steps up the chain. > > / > Leif > > > + return NULL; > > + } > > Buffer = AllocatePool (BlockIo->Media->BlockSize); > > if (Buffer != NULL) { > > BlockIo->ReadBlocks ( > > -- > > 2.9.5 > > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel