[ovs-dev] [PATCH] datapath-windows: Handle memory allocation failure for event creation

Sairam Venugopal vsairam at vmware.com
Fri Jun 24 21:14:51 UTC 2016


Hi Alin,

Thanks for the review. We currently post only 1 event at a time. Hence the
return statement instead of continue.

The previous continue tries to match the current event to the right queue
based on the Type and Queue Mask.

Regard,
Sairam

On 6/22/16, 7:40 AM, "Alin Serdean" <aserdean at cloudbasesolutions.com>
wrote:

>
>
>
>
>> -----Mesaj original-----
>
>> De la: dev [mailto:dev-bounces at openvswitch.org] În numele Sairam
>
>> Venugopal
>
>> Trimis: Wednesday, June 22, 2016 2:54 AM
>
>> Către: dev at openvswitch.org
>
>> Subiect: [ovs-dev] [PATCH] datapath-windows: Handle memory allocation
>
>> failure for event creation
>
>> 
>
>> Release the lock and return if an event entry fails to get allocated.
>
>> 
>
>> Signed-off-by: Sairam Venugopal <vsairam at vmware.com>
>
>> ---
>
>>  datapath-windows/ovsext/Event.c | 7 +++++++
>
>>  1 file changed, 7 insertions(+)
>
>> 
>
>> diff --git a/datapath-windows/ovsext/Event.c b/datapath-
>
>> windows/ovsext/Event.c index abf8f0d..f9bea7f 100644
>
>> --- a/datapath-windows/ovsext/Event.c
>
>> +++ b/datapath-windows/ovsext/Event.c
>
>> @@ -134,6 +134,13 @@ OvsPostEvent(POVS_EVENT_ENTRY event)
>
>> 
>
>>          elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemoryWithTag(
>
>>              sizeof(*elem), OVS_EVENT_POOL_TAG);
>
>> +
>
>> +        if (elem == NULL) {
>
>> +            OVS_LOG_WARN("Fail to allocate memory for event");
>
>> +            OvsReleaseEventQueueLock();
>
>> +            return;
>
>[Alin Gabriel Serdean: ] maybe continue; instead of return; future
>allocations may be successful, but maybe that is me. Otherwise
>
>Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
>
>> +        }
>
>> +
>
>>          RtlCopyMemory(&elem->event, event, sizeof elem->event);
>
>>          InsertTailList(&queue->elemList, &elem->link);
>
>>          queue->numElems++;
>
>> --
>
>> 2.5.0.windows.1
>
>> 
>
>> _______________________________________________
>
>> dev mailing list
>
>> dev at openvswitch.org
>
>> 
>>https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailm
>>an_listinfo_dev&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=
>>Dcruz40PROJ40ROzSpxyQSLw6fcrOWpJgEcEmNR3JEQ&m=JtES1-c_iyhoUC8-DfZCeL2VT_p
>>yLYGKy2xihcEqHqM&s=-_axeQGoTqqfYlTbiCtsV-JTzAqOg9Sr19qVvoZXDyY&e=
>



More information about the dev mailing list