diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-04-28 05:15:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:42 -0400 |
commit | 4ef197d87ad7d4bb326de3e9b8ecbb26f9e86253 (patch) | |
tree | f6bc4fde8c1955d9b8d6669fcc08e15e3cd6fa7e /drivers/md | |
parent | 8b3e6cdc53b7f29f7026955d6cb6902a49322a15 (diff) |
md: raid5.c convert simple_strtoul to strict_strtoul
strict_strtoul handles the open-coded sanity checks in
raid5_store_stripe_cache_size and raid5_store_preread_threshold
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-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; |