public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Wenyi Xie <xiewenyi2@huawei.com>,
	devel@edk2.groups.io, jordan.l.justen@intel.com,
	ard.biesheuvel@arm.com
Cc: songdongkuang@huawei.com
Subject: Re: [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating
Date: Tue, 24 Nov 2020 00:15:41 +0100	[thread overview]
Message-ID: <69a4905d-0f8e-052c-fe75-f528cd9be7cc@redhat.com> (raw)
In-Reply-To: <1606113320-7758-2-git-send-email-xiewenyi2@huawei.com>

On 11/23/20 07:35, Wenyi Xie wrote:
> add assert after pool allocating.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
>  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


  reply	other threads:[~2020-11-23 23:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23  6:35 [PATCH EDK2 v1 0/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating wenyi,xie
2020-11-23  6:35 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-11-23 23:15   ` Laszlo Ersek [this message]
2020-11-24  1:19     ` wenyi,xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69a4905d-0f8e-052c-fe75-f528cd9be7cc@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox