public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating
@ 2020-11-23  6:35 wenyi,xie
  2020-11-23  6:35 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-11-23  6:35 UTC (permalink / raw)
  To: devel, jordan.l.justen, lersek, ard.biesheuvel; +Cc: songdongkuang, xiewenyi2

Main Changes :
add assert after pool allocating.

Wenyi Xie (1):
  OvmfPkg/XenPvBlkDxe: add assert for pool allocating

 OvmfPkg/XenPvBlkDxe/BlockFront.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating
  2020-11-23  6:35 [PATCH EDK2 v1 0/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating wenyi,xie
@ 2020-11-23  6:35 ` wenyi,xie
  2020-11-23 23:15   ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-11-23  6:35 UTC (permalink / raw)
  To: devel, jordan.l.justen, lersek, ard.biesheuvel; +Cc: songdongkuang, xiewenyi2

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;
-- 
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating
  2020-11-23  6:35 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2020-11-23 23:15   ` Laszlo Ersek
  2020-11-24  1:19     ` wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2020-11-23 23:15 UTC (permalink / raw)
  To: Wenyi Xie, devel, jordan.l.justen, ard.biesheuvel; +Cc: songdongkuang

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating
  2020-11-23 23:15   ` Laszlo Ersek
@ 2020-11-24  1:19     ` wenyi,xie
  0 siblings, 0 replies; 4+ messages in thread
From: wenyi,xie @ 2020-11-24  1:19 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: songdongkuang



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 <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.

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
> 
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-24  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2020-11-24  1:19     ` wenyi,xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox