From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web08.45696.1606180793160578233 for ; Mon, 23 Nov 2020 17:19:53 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.191, mailfrom: xiewenyi2@huawei.com) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Cg5lc413mzLtYB; Tue, 24 Nov 2020 09:19:24 +0800 (CST) Received: from [10.174.152.217] (10.174.152.217) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Tue, 24 Nov 2020 09:19:43 +0800 Subject: Re: [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating To: Laszlo Ersek , CC: References: <1606113320-7758-1-git-send-email-xiewenyi2@huawei.com> <1606113320-7758-2-git-send-email-xiewenyi2@huawei.com> <69a4905d-0f8e-052c-fe75-f528cd9be7cc@redhat.com> From: "wenyi,xie" Message-ID: <2ff898f8-eea9-edb2-ac68-c4542257c997@huawei.com> Date: Tue, 24 Nov 2020 09:19:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: <69a4905d-0f8e-052c-fe75-f528cd9be7cc@redhat.com> X-Originating-IP: [10.174.152.217] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit On 2020/11/24 7:15, Laszlo Ersek wrote: > On 11/23/20 07:35, Wenyi Xie wrote: >> add assert after pool allocating. >> >> Cc: Jordan Justen >> Cc: Laszlo Ersek >> Cc: Ard Biesheuvel >> Signed-off-by: Wenyi Xie >> --- >> OvmfPkg/XenPvBlkDxe/BlockFront.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c >> index 122a6baed25a..bde385090832 100644 >> --- a/OvmfPkg/XenPvBlkDxe/BlockFront.c >> +++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c >> @@ -155,6 +155,7 @@ XenPvBlockFrontInitialization ( >> ASSERT (NodeName != NULL); >> >> Dev = AllocateZeroPool (sizeof (XEN_BLOCK_FRONT_DEVICE)); >> + ASSERT (Dev != NULL); >> Dev->Signature = XEN_BLOCK_FRONT_SIGNATURE; >> Dev->NodeName = NodeName; >> Dev->XenBusIo = XenBusIo; >> > > (1) Please use "BaseTools/Scripts/GetMaintainer.py" for determining the > necessary CC's on a patch. On this patch, the Xen reviewers should be > CC'd as well. OK, I will correct the reviewers. > > (2) I agree that the AllocateZeroPool() result should be checked, but an > ASSERT() is inappropriate. The function's return type is EFI_STATUS, so > returning EFI_OUT_OF_RESOURCES should be possible. The call site in > XenPvBlkDxeDriverBindingStart() does check the return value. I see, thanks. > > Thanks > Laszlo > > . >