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

Alin Serdean aserdean at cloudbasesolutions.com
Wed Jun 22 14:40:43 UTC 2016



> -----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
> http://openvswitch.org/mailman/listinfo/dev


More information about the dev mailing list