]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
DM RAID: Fix comparison of index and quantity for "rebuild" parameter
authorJonathan Brassow <jbrassow@redhat.com>
Mon, 24 Sep 2012 06:41:29 +0000 (16:41 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 24 Sep 2012 06:41:29 +0000 (16:41 +1000)
DM RAID: Fix comparison of index and quantity for "rebuild" parameter

The "rebuild" parameter takes an index argument that starts counting from
zero.  The conditional used to validate the index was using '>' rather than
'>=', leaving the door open for an index value that would be 1 too large.

Reported-by: Neil Brown <neilb@suse.de>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/dm-raid.c

index 4e79ebaab3c1d11502c9fc94bfa9199e64dce827..89a06a36133218a2c650036dbf3751c7ccd8aec4 100644 (file)
@@ -539,7 +539,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
 
                /* Parameters that take a numeric value are checked here */
                if (!strcasecmp(key, "rebuild")) {
-                       if (value > rs->md.raid_disks) {
+                       if (value >= rs->md.raid_disks) {
                                rs->ti->error = "Invalid rebuild index given";
                                return -EINVAL;
                        }