[edk2-devel] [PATCH EDK2 v1 1/1] OvmfPkg/XenPvBlkDxe: add assert for pool allocating

wenyi,xie via groups.io xiewenyi2=huawei.com at groups.io
Tue Nov 24 01:19:36 UTC 2020



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 at intel.com>
>> Cc: Laszlo Ersek <lersek at redhat.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
>> Signed-off-by: Wenyi Xie <xiewenyi2 at 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
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67851): https://edk2.groups.io/g/devel/message/67851
Mute This Topic: https://groups.io/mt/78448102/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list