diff mbox series

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

Message ID 20180709134056.7060-4-aserdean@ovn.org
State Changes Requested
Headers show
Series Cleanup datapath-windows | expand

Commit Message

Alin-Gabriel Serdean July 9, 2018, 1:40 p.m. UTC
Do not assign an initial value for the variable `entry`, it will
be reassigned later on.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 datapath-windows/ovsext/Conntrack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shashank Ram July 11, 2018, 10:54 p.m. UTC | #1
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@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?
diff mbox series

Patch

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;