]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
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 b0458c899b72de9d6dc638c22201e15b1d31b5a5..350f4024c1301377103209ffbbe45ed6a515f0cd 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)) {