libadmin: Catch VL_GetNewVolumeId failures
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 26 Feb 2013 11:59:56 +0000 (11:59 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 26 Feb 2013 21:57:30 +0000 (13:57 -0800)
If ubik_VL_GetVolumeId fails in the vos ProcessEntries routine,
report the failure and give up, rather than continuing with a
0 maxVolid

Caught by coverity (#988417)

Change-Id: I281e1c518813f9d7fab46e4f87a091fac6b3a754
Reviewed-on: http://gerrit.openafs.org/9268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/libadmin/vos/vsprocs.c

index 30c47a3..52a4b72 100644 (file)
@@ -2996,22 +2996,31 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
        if (maxVolid <= elem.ids[RWVOL]) {
            temp2 = elem.ids[RWVOL] - maxVolid + 1;
            maxVolid = 0;
-           ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
-                                  &maxVolid);
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
+
            maxVolid += temp2;
        }
        if (maxVolid <= elem.ids[ROVOL]) {
            temp2 = elem.ids[ROVOL] - maxVolid + 1;
            maxVolid = 0;
-           ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
-                                  &maxVolid);
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
+
            maxVolid += temp2;
        }
        if (maxVolid <= elem.ids[BACKVOL]) {
            temp2 = elem.ids[BACKVOL] - maxVolid + 1;
            maxVolid = 0;
-           ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
-                                  &maxVolid);
+           vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, temp2,
+                                          &maxVolid);
+           if (vcode)
+               return vcode;
+
            maxVolid += temp2;
        }
        aVLDB_GetEntryByID(cellHandle, elem.ids[RWVOL], RWVOL, &entry, &tst);