From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::32c; helo=mail-wm1-x32c.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1A022201B0457 for ; Mon, 18 Mar 2019 05:42:36 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id z11so4345373wmi.0 for ; Mon, 18 Mar 2019 05:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SXUX4Y3VtMunzgtfP6OqUL7M1BFgjv1gPJVjpLYkLYU=; b=JutGZCzgMUULpj/DxkCQw2OsUS3wRpDE/ZbhvtHzsyIANj/+VG3QVvqcl4aLAP+dYR G2EZBoloJs/MtTSivI5Gj65VgLJ9y9v271xPLD3IFZ8+VbLvENmtQlnNYJkFdulS7GJO E6sBJm0y0FeqGWTYbOVfkPt7/8m+BxMh3iMeg+ijA8F6LZ9lTFjV97lx4F7ahPPRNZbH 9DQjzFNOAT6amIAajzOiOZdDlAZZn1qrEwLL1o7KJh0LZQtKL7yiFpS7VeY8xFNwgzcH Lelsq5vVjCvp45LLY+uAdOUQMaSm7HyKCkw2Tk0MCblA9uy3XZtxuXO/VPbp2fSVRYxP Bd0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SXUX4Y3VtMunzgtfP6OqUL7M1BFgjv1gPJVjpLYkLYU=; b=PRLUvw/2kUNYXQfuYgIie+maVKdKd4jkfHfsqgo88lTUbHfjHHLjXvRJ/QW33g4yLu 6N0RvYVD9ejbaHL/neDH0IEe2CoaOCuf26yUkJu/A56ce864bXoaEFTxR05uDeTD/r28 k+dSCosROWlGQs5hNR/aq5rHlKXV3vAf6JRRBeQBh7WeSBjWGOiZQjg5wiB+o9cYI24W kFvXm5wtQhAEf/RiHTO2NdGVpndYO6iqFktsCP68gUNcOfTT9OqhNBRc5yCWtK8qvRvj VFHA4OnQKfLgfWYoVOZTP2gqpc9lX+RXDkDVDQjfq8FRu832kP/ZsAWPxv5nJjeaDP65 rb6A== X-Gm-Message-State: APjAAAVX9BxKFW8QuVpOOfEjGqmsmi0Z5CTxhStdVGjvi0AVaNc8ogiY B3PejJV9aQEarI7zjgUswOGtWA== X-Google-Smtp-Source: APXvYqyPJyTt9PM1xIb0WyfFfvynYhAYE6tUReI3ZjCwuz6KP1E/92aEmd/C/gDvEDHThpIggdb4JQ== X-Received: by 2002:a1c:96ce:: with SMTP id y197mr11248317wmd.126.1552912955414; Mon, 18 Mar 2019 05:42:35 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id s127sm6729955wmf.39.2019.03.18.05.42.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Mar 2019 05:42:34 -0700 (PDT) Date: Mon, 18 Mar 2019 12:42:32 +0000 From: Leif Lindholm To: Ming Huang Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, star.zeng@intel.com, eric.dong@intel.com, ruiyu.ni@intel.com, dann.frazier@canonical.com, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, liming.gao@intel.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, waip23@126.com, Jian J Wang , Hao Wu , Ray Ni Message-ID: <20190318124232.67pblu6tbdi47g2w@bivouac.eciton.net> References: <20190225091052.25461-1-ming.huang@linaro.org> <20190225091052.25461-2-ming.huang@linaro.org> MIME-Version: 1.0 In-Reply-To: <20190225091052.25461-2-ming.huang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) 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: Mon, 18 Mar 2019 12:42:37 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline +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 > 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 = 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 >