diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid5.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 45eead608647..9bc603181bcb 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4041,15 +4041,13 @@ static ssize_t | |||
4041 | raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) | 4041 | raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) |
4042 | { | 4042 | { |
4043 | raid5_conf_t *conf = mddev_to_conf(mddev); | 4043 | raid5_conf_t *conf = mddev_to_conf(mddev); |
4044 | char *end; | 4044 | unsigned long new; |
4045 | int new; | ||
4046 | if (len >= PAGE_SIZE) | 4045 | if (len >= PAGE_SIZE) |
4047 | return -EINVAL; | 4046 | return -EINVAL; |
4048 | if (!conf) | 4047 | if (!conf) |
4049 | return -ENODEV; | 4048 | return -ENODEV; |
4050 | 4049 | ||
4051 | new = simple_strtoul(page, &end, 10); | 4050 | if (strict_strtoul(page, 10, &new)) |
4052 | if (!*page || (*end && *end != '\n') ) | ||
4053 | return -EINVAL; | 4051 | return -EINVAL; |
4054 | if (new <= 16 || new > 32768) | 4052 | if (new <= 16 || new > 32768) |
4055 | return -EINVAL; | 4053 | return -EINVAL; |
@@ -4087,17 +4085,15 @@ static ssize_t | |||
4087 | raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len) | 4085 | raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len) |
4088 | { | 4086 | { |
4089 | raid5_conf_t *conf = mddev_to_conf(mddev); | 4087 | raid5_conf_t *conf = mddev_to_conf(mddev); |
4090 | char *end; | 4088 | unsigned long new; |
4091 | int new; | ||
4092 | if (len >= PAGE_SIZE) | 4089 | if (len >= PAGE_SIZE) |
4093 | return -EINVAL; | 4090 | return -EINVAL; |
4094 | if (!conf) | 4091 | if (!conf) |
4095 | return -ENODEV; | 4092 | return -ENODEV; |
4096 | 4093 | ||
4097 | new = simple_strtoul(page, &end, 10); | 4094 | if (strict_strtoul(page, 10, &new)) |
4098 | if (!*page || (*end && *end != '\n')) | ||
4099 | return -EINVAL; | 4095 | return -EINVAL; |
4100 | if (new > conf->max_nr_stripes || new < 0) | 4096 | if (new > conf->max_nr_stripes) |
4101 | return -EINVAL; | 4097 | return -EINVAL; |
4102 | conf->bypass_threshold = new; | 4098 | conf->bypass_threshold = new; |
4103 | return len; | 4099 | return len; |