From 5960468efc008ae3e9a578de2c5b8d4e03cabb89 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Thu, 22 Apr 2010 17:22:37 -0400 Subject: [PATCH] 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 (cherry-picked from commit 0dac8f93af5262472bc5bdf94dbb605a24da59d0) Change-Id: I3311ad5a73e21f7fb44f9dcf0cda251bae96eb0f Reviewed-on: http://gerrit.openafs.org/2008 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_volume.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 007cae965..87b32e0d7 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -111,7 +111,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) { @@ -199,6 +199,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; -- 2.39.5