[ovs-dev] [PATCH 03/14] datapath-windows: Cleanup Conntrack.c

Shashank Ram rams at vmware.com
Wed Jul 11 22:54:06 UTC 2018



On 07/09/2018 06:40 AM, Alin Gabriel Serdean wrote:
> Do not assign an initial value for the variable `entry`, it will
> be reassigned later on.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean at ovn.org>
> ---
>   datapath-windows/ovsext/Conntrack.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c
> index dd1660218..0fa35fed7 100644
> --- a/datapath-windows/ovsext/Conntrack.c
> +++ b/datapath-windows/ovsext/Conntrack.c
> @@ -841,7 +841,7 @@ OvsCtExecute_(OvsForwardingContext *fwdCtx,
>       NDIS_STATUS status = NDIS_STATUS_SUCCESS;
>       BOOLEAN triggerUpdateEvent = FALSE;
>       BOOLEAN entryCreated = FALSE;
> -    POVS_CT_ENTRY entry = NULL;
> +    POVS_CT_ENTRY entry;
>       PNET_BUFFER_LIST curNbl = fwdCtx->curNbl;
>       OvsConntrackKeyLookupCtx ctx = { 0 };
>       LOCK_STATE_EX lockStateTable;

I think its better to initialize the variable to NULL because if someone 
were to change the way 'entry' is currently getting initialized your 
assumption would not hold true. What do you think about leaving this as 
is? Is this being flagged by cppcheck?


More information about the dev mailing list