@@ -1371,7 +1371,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
* MD records this value in kB
*/
value /= 2;
- if (value > COUNTER_MAX) {
+ if (!__within_range(value, 1, COUNTER_MAX)) {
rs->ti->error = "Max write-behind limit out of range";
return -EINVAL;
}
@@ -1382,7 +1382,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
rs->ti->error = "Only one daemon_sleep argument pair allowed";
return -EINVAL;
}
- if (!value || (value > MAX_SCHEDULE_TIMEOUT)) {
+ if (!__within_range(value, 1, MAX_SCHEDULE_TIMEOUT)) {
rs->ti->error = "daemon sleep period out of range";
return -EINVAL;
}
@@ -1430,7 +1430,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
rs->ti->error = "Only one min_recovery_rate argument pair allowed";
return -EINVAL;
}
- if (value > INT_MAX) {
+ if (!__within_range(value, 1, INT_MAX)) {
rs->ti->error = "min_recovery_rate out of range";
return -EINVAL;
}
@@ -1440,7 +1440,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
rs->ti->error = "Only one max_recovery_rate argument pair allowed";
return -EINVAL;
}
- if (value > INT_MAX) {
+ if (!__within_range(value, 1, INT_MAX)) {
rs->ti->error = "max_recovery_rate out of range";
return -EINVAL;
}
parse_raid_params() doesn't use __with_rnage() to check argument values throughout. Add where appropriate. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> --- drivers/md/dm-raid.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)