From: Andy Shevchenko Date: Wed, 1 Sep 2010 06:26:46 +0000 (+0300) Subject: mmc_test: change simple_strtol() to strict_strtol() X-Git-Tag: Ubuntu-5.10.0-12.13~26620^2~54 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=5c25aee5364550d7fa6314886370e76cda18d7e2;p=mirror_ubuntu-hirsute-kernel.git mmc_test: change simple_strtol() to strict_strtol() 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 Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index e27806d6458c..2888fdccd7ad 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -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)