DragonFlyBSD Kernel Audit
DF-1398 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/vinum/vinumconfig.c b/sys/dev/raid/vinum/vinumconfig.c
--- a/sys/dev/raid/vinum/vinumconfig.c
+++ b/sys/dev/raid/vinum/vinumconfig.c
@@ -1728,7 +1728,7 @@
     struct drive *drive = &DRIVE[driveno];
     int sdno;
 
-    if ((driveno > vinum_conf.drives_allocated)		    /* not a valid drive */
+    if ((driveno >= vinum_conf.drives_allocated)		    /* not a valid drive */
     ||(drive->state == drive_unallocated)) {		    /* or nothing there */
 	ioctl_reply->error = EINVAL;
 	strcpy(ioctl_reply->msg, "No such drive");
@@ -1755,7 +1755,7 @@
 {
     struct sd *sd = &SD[sdno];
 
-    if ((sdno > vinum_conf.subdisks_allocated)		    /* not a valid sd */
+    if ((sdno >= vinum_conf.subdisks_allocated)		    /* not a valid sd */
     ||(sd->state == sd_unallocated)) {			    /* or nothing there */
 	ioctl_reply->error = EINVAL;
 	strcpy(ioctl_reply->msg, "No such subdisk");
@@ -1809,7 +1809,7 @@
     struct plex *plex = &PLEX[plexno];
     int sdno;
 
-    if ((plexno > vinum_conf.plexes_allocated)		    /* not a valid plex */
+    if ((plexno >= vinum_conf.plexes_allocated)		    /* not a valid plex */
     ||(plex->state == plex_unallocated)) {		    /* or nothing there */
 	ioctl_reply->error = EINVAL;
 	strcpy(ioctl_reply->msg, "No such plex");
@@ -1868,7 +1868,7 @@
     struct volume *vol = &VOL[volno];
     int plexno;
 
-    if ((volno > vinum_conf.volumes_allocated)		    /* not a valid volume */
+    if ((volno >= vinum_conf.volumes_allocated)		    /* not a valid volume */
     ||(vol->state == volume_unallocated)) {		    /* or nothing there */
 	ioctl_reply->error = EINVAL;
 	strcpy(ioctl_reply->msg, "No such volume");