diff options
author | Jonthan Brassow <jbrassow@redhat.com> | 2011-09-26 00:26:19 +0200 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-09-26 00:26:19 +0200 |
commit | 8232480944d173378082ebb2cac8a3207c08cf31 (patch) | |
tree | d77436773e5c8a2274e1b0db507e5c251f225ecf | |
parent | dm table: avoid crash if integrity profile changes (diff) | |
download | linux-8232480944d173378082ebb2cac8a3207c08cf31.tar.xz linux-8232480944d173378082ebb2cac8a3207c08cf31.zip |
dm: raid fix write_mostly arg validation
Fix off-by-one error in validation of write_mostly.
The user-supplied value given for the 'write_mostly' argument must be an
index starting at 0. The validation of the supplied argument failed to
check for 'N' ('>' vs '>='), which would have caused an access beyond the
end of the array.
Reported-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r-- | drivers/md/dm-raid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index a002dd85db1e..86df8b2cf927 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -449,7 +449,7 @@ static int parse_raid_params(struct raid_set *rs, char **argv, rs->ti->error = "write_mostly option is only valid for RAID1"; return -EINVAL; } - if (value > rs->md.raid_disks) { + if (value >= rs->md.raid_disks) { rs->ti->error = "Invalid write_mostly drive index given"; return -EINVAL; } |