[ovs-dev,v2,6/7] datapath-windows: Fix static analysis warnings around ovsInstanceListLock

Message ID 20171106153339.10100-6-aserdean@ovn.org
State New
Headers show
Series
  • [ovs-dev,v2,1/7] datapath-windows: Use only non executable memory
Related show

Commit Message

Alin Gabriel Serdean Nov. 6, 2017, 3:33 p.m.
From: Alin Serdean <aserdean@cloudbasesolutions.com>

Check for return value when trying to initialize ovsInstanceListLock.

Also return the status back to caller of `OvsInitIpHelper`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
v2: Removed an extra return. Suggested by: Shashank Ram rams@vmware.com
---
 datapath-windows/ovsext/IpHelper.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Patch

diff --git a/datapath-windows/ovsext/IpHelper.c b/datapath-windows/ovsext/IpHelper.c
index e995e56..6bbd096 100644
--- a/datapath-windows/ovsext/IpHelper.c
+++ b/datapath-windows/ovsext/IpHelper.c
@@ -1989,6 +1989,12 @@  OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle)
     HANDLE threadHandle;
     UINT32 i;
 
+    status = ExInitializeResourceLite(&ovsInstanceListLock);
+    if (status != NDIS_STATUS_SUCCESS) {
+        return status;
+    }
+    InitializeListHead(&ovsInstanceList);
+
     ovsFwdHashTable = (PLIST_ENTRY)OvsAllocateMemoryWithTag(
         sizeof(LIST_ENTRY) * OVS_FWD_HASH_TABLE_SIZE, OVS_IPHELPER_POOL_TAG);
 
@@ -2009,9 +2015,6 @@  OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle)
     ipRouteNotificationHandle = NULL;
     unicastIPNotificationHandle = NULL;
 
-    ExInitializeResourceLite(&ovsInstanceListLock);
-    InitializeListHead(&ovsInstanceList);
-
     if (ovsFwdHashTable == NULL ||
         ovsRouteHashTable == NULL ||
         ovsNeighHashTable == NULL ||
@@ -2074,7 +2077,7 @@  init_cleanup:
         ExDeleteResourceLite(&ovsInstanceListLock);
         NdisFreeSpinLock(&ovsIpHelperLock);
     }
-    return STATUS_SUCCESS;
+    return status;
 }