From: Marc Dionne Date: Thu, 22 Apr 2010 21:22:37 +0000 (-0400) Subject: Initialize oldvtix X-Git-Tag: openafs-devel-1_5_75~372 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=0dac8f93af5262472bc5bdf94dbb605a24da59d0;hp=1798fe6da1d40c083bc10fe101a73b5f67b6fa0d Initialize oldvtix Initialize the variable to avoid compiler complaints that it could be used uninitialized. Use a sentinel value and issue a warning if we try to use the variable and we haven't set it to a useful value. Change-Id: I037be2ad8e0b55d06b50aafdeca5012764640f16 Reviewed-on: http://gerrit.openafs.org/1810 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index cdfe174..4548abd 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -119,7 +119,7 @@ afs_UFSGetVolSlot(void) afs_int32 bestTime; struct volume *bestVp, *oldLp = NULL, **bestLp = NULL; char *oldname = NULL; - afs_int32 oldvtix; + afs_int32 oldvtix = -2; /* Initialize to a value that doesn't occur */ AFS_STATCNT(afs_UFSGetVolSlot); if (!afs_freeVolList) { @@ -207,6 +207,10 @@ afs_UFSGetVolSlot(void) error: if (tv) { + if (oldtvix == -2) { + afs_warn("afs_UFSGetVolSlot: oldvtix is uninitialized\n"); + return NULL; + } if (oldname) { tv->name = oldname; oldname = NULL;