Skip to content

Commit

Permalink
mmc_test: change simple_strtol() to strict_strtol()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Shevchenko authored and Chris Ball committed Oct 23, 2010
1 parent 63be54c commit 5c25aee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/mmc/card/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5c25aee

Please sign in to comment.