summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-04-28 11:15:54 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 17:58:42 +0200
commit4ef197d87ad7d4bb326de3e9b8ecbb26f9e86253 (patch)
treef6bc4fde8c1955d9b8d6669fcc08e15e3cd6fa7e /drivers/md/raid5.c
parentmd: introduce get_priority_stripe() to improve raid456 write performance (diff)
downloadlinux-4ef197d87ad7d4bb326de3e9b8ecbb26f9e86253.tar.xz
linux-4ef197d87ad7d4bb326de3e9b8ecbb26f9e86253.zip
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/raid5.c')
-rw-r--r--drivers/md/raid5.c14
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
raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
{
raid5_conf_t *conf = mddev_to_conf(mddev);
- char *end;
- int new;
+ unsigned long new;
if (len >= PAGE_SIZE)
return -EINVAL;
if (!conf)
return -ENODEV;
- new = simple_strtoul(page, &end, 10);
- if (!*page || (*end && *end != '\n') )
+ if (strict_strtoul(page, 10, &new))
return -EINVAL;
if (new <= 16 || new > 32768)
return -EINVAL;
@@ -4087,17 +4085,15 @@ static ssize_t
raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len)
{
raid5_conf_t *conf = mddev_to_conf(mddev);
- char *end;
- int new;
+ unsigned long new;
if (len >= PAGE_SIZE)
return -EINVAL;
if (!conf)
return -ENODEV;
- new = simple_strtoul(page, &end, 10);
- if (!*page || (*end && *end != '\n'))
+ if (strict_strtoul(page, 10, &new))
return -EINVAL;
- if (new > conf->max_nr_stripes || new < 0)
+ if (new > conf->max_nr_stripes)
return -EINVAL;
conf->bypass_threshold = new;
return len;