mmc_test: change simple_strtol() to strict_strtol()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Wed, 1 Sep 2010 06:26:46 +0000 (09:26 +0300)
committerChris Ball <cjb@laptop.org>
Sat, 23 Oct 2010 13:11:12 +0000 (21:11 +0800)
It's better to use strict_strtol() to convert user's input and strictly
check it. At least it forbids to interpret wrong input as a 0 and
prevents to run all tests.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/card/mmc_test.c

index e27806d6458c7a8959dc262d9befa23e4c205482..2888fdccd7ad1b6942bac547838c434684ba3842 100644 (file)
@@ -2024,9 +2024,10 @@ static ssize_t mmc_test_store(struct device *dev,
 {
        struct mmc_card *card = mmc_dev_to_card(dev);
        struct mmc_test_card *test;
-       int testcase;
+       long testcase;
 
-       testcase = simple_strtol(buf, NULL, 10);
+       if (strict_strtol(buf, 10, &testcase))
+               return -EINVAL;
 
        test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
        if (!test)