DM RAID: Fix comparison of index and quantity for "rebuild" parameter

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>
This commit is contained in:
Jonathan Brassow 2012-10-11 13:40:36 +11:00 committed by NeilBrown
parent 4ec1e369af
commit 7386199c47
1 changed files with 1 additions and 1 deletions

View 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 */ /* Parameters that take a numeric value are checked here */
if (!strcasecmp(key, "rebuild")) { if (!strcasecmp(key, "rebuild")) {
if (value > rs->md.raid_disks) { if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given"; rs->ti->error = "Invalid rebuild index given";
return -EINVAL; return -EINVAL;
} }