From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 317AC21A00AE6 for ; Mon, 18 Mar 2019 19:25:40 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 19:25:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,496,1544515200"; d="scan'208";a="328487125" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 18 Mar 2019 19:25:40 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Mar 2019 19:25:40 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Mar 2019 19:25:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.57]) with mapi id 14.03.0415.000; Tue, 19 Mar 2019 10:25:38 +0800 From: "Wu, Hao A" To: Leif Lindholm , Ming Huang CC: "linaro-uefi@lists.linaro.org" , "edk2-devel@lists.01.org" , "Zeng, Star" , "Dong, Eric" , "Ni, Ray" , "dann.frazier@canonical.com" , "ard.biesheuvel@linaro.org" , "Kinney, Michael D" , "Gao, Liming" , "wanghuiqiang@huawei.com" , "huangming23@huawei.com" , "zhangjinsong2@huawei.com" , "huangdaode@hisilicon.com" , "waip23@126.com" , "Wang, Jian J" , "Ni, Ray" Thread-Topic: [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue Thread-Index: AQHU3YgTR4zb5TTpd06aS+ZGuE9hCKYSOCmA Date: Tue, 19 Mar 2019 02:25:38 +0000 Message-ID: References: <20190225091052.25461-1-ming.huang@linaro.org> <20190225091052.25461-2-ming.huang@linaro.org> <20190318124232.67pblu6tbdi47g2w@bivouac.eciton.net> In-Reply-To: <20190318124232.67pblu6tbdi47g2w@bivouac.eciton.net> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 02:25:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > Sent: Monday, March 18, 2019 8:43 PM > To: Ming Huang > Cc: linaro-uefi@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; Do= ng, > Eric; Ni, Ray; dann.frazier@canonical.com; ard.biesheuvel@linaro.org; Kin= ney, > Michael D; Gao, Liming; wanghuiqiang@huawei.com; > huangming23@huawei.com; zhangjinsong2@huawei.com; > huangdaode@hisilicon.com; waip23@126.com; Wang, Jian J; Wu, Hao A; Ni, > Ray > Subject: Re: [MdeModulePkg/Library v1 1/1] > MdeModulePkg/UefiBootManangerLib: Fix exception issue >=20 > +MdeModulePkg maintainers (you added MdePkg maintainers to cc) >=20 > This looks like an improvement to me. >=20 > Am I correct in guessing this behaviour refers to some specific corner > case of a USB CDROM emulated from a BMC? >=20 > 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 =3D 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:=20 Status =3D gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePa= th, &Handle); ASSERT_EFI_ERROR (Status); And leave: Status =3D 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 > > --- > > 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 =3D gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (V= OID > **) &BlockIo); > > - ASSERT_EFI_ERROR (Status); > > + if (EFI_ERROR (Status)) { >=20 > 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. >=20 > / > Leif >=20 > > + return NULL; > > + } > > Buffer =3D AllocatePool (BlockIo->Media->BlockSize); > > if (Buffer !=3D NULL) { > > BlockIo->ReadBlocks ( > > -- > > 2.9.5 > >