vol: Don't return an uninited val from LookupNode
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 31 Mar 2012 15:51:19 +0000 (11:51 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 9 Apr 2012 01:19:14 +0000 (18:19 -0700)
If the SalvageHashTable for a particular node is empty, then LookupNode
can return an uninitialised value to the caller. It isn't clear from a
broader code inspection whether LookupNode can ever be called with an
empty SalvageHashTable, but returning a NULL vsp does seem like the
correct thing to do in this situation.

Caught by clang-analyzer

Change-Id: Ibee79e6acf7d3bdbc2995ef924338ade4de77d08
Reviewed-on: http://gerrit.openafs.org/7094
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/vol/salvsync-server.c

index b0458c8..350f402 100644 (file)
@@ -188,7 +188,7 @@ LookupNode(afs_uint32 vid, char * partName,
           struct SalvageQueueNode ** parent)
 {
     struct rx_queue *qp, *nqp;
-    struct SalvageQueueNode *vsp;
+    struct SalvageQueueNode *vsp = NULL;
     int idx = VSHASH(vid);
 
     for (queue_Scan(&SalvageHashTable[idx], qp, nqp, rx_queue)) {