From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.44191.1606173350589509396 for ; Mon, 23 Nov 2020 15:15:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bcnyGZeP; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606173349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8kwdhgzpja0mBYMeXnc/I0Y2QdxwAzzXrvhlUoM3Hmg=; b=bcnyGZePpb/8dC47D+mcooOQQE8cecD+H2TaNE/sZzl/MVF6NfTnvu431azW6FKnikCro0 BCaaQnwdhGk0lJJNrHhDn2MmynbiH51XTkOK2Cq2bI3Gx5ZEclpyv8xnObB/Ew21b32ZgM YzKBbVVgaB4sPEBbtwtiI8xCYNuMfIU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-SDXO6X9RME64CsTdGLCe4w-1; Mon, 23 Nov 2020 18:15:45 -0500 X-MC-Unique: SDXO6X9RME64CsTdGLCe4w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E19D18C43C8; Mon, 23 Nov 2020 23:15:44 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-230.ams2.redhat.com [10.36.112.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC44A6062F; Mon, 23 Nov 2020 23:15:42 +0000 (UTC) Subject: Re: [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating To: Wenyi Xie , devel@edk2.groups.io, jordan.l.justen@intel.com, ard.biesheuvel@arm.com Cc: songdongkuang@huawei.com References: <1606113320-7758-1-git-send-email-xiewenyi2@huawei.com> <1606113320-7758-2-git-send-email-xiewenyi2@huawei.com> From: "Laszlo Ersek" Message-ID: <69a4905d-0f8e-052c-fe75-f528cd9be7cc@redhat.com> Date: Tue, 24 Nov 2020 00:15:41 +0100 MIME-Version: 1.0 In-Reply-To: <1606113320-7758-2-git-send-email-xiewenyi2@huawei.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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. (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. Thanks Laszlo