]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
md: raid5.c convert simple_strtoul to strict_strtoul
authorDan Williams <dan.j.williams@intel.com>
Mon, 28 Apr 2008 09:15:54 +0000 (02:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:42 +0000 (08:58 -0700)
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>
drivers/md/raid5.c

index 45eead6086475b3e7c5386f6008912f2aad963b6..9bc603181bcb61329f45725ac8a557c7a74b9ab4 100644 (file)
@@ -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;