From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
To: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Hunter Adrian <adrian.hunter@nokia.com>,
Chris Ball <cjb@laptop.org>,
Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Subject: [PATCHv5 2/3] mmc_test: change simple_strtol() to strict_strtol()
Date: Mon, 6 Sep 2010 11:12:18 +0300 [thread overview]
Message-ID: <59ad4bca0f707b11525dcdbe65dd117d964e4523.1283760476.git.ext-andriy.shevchenko@nokia.com> (raw)
In-Reply-To: <3fa57fe7152b608279ec56dcfe969a42b672a197.1283760476.git.ext-andriy.shevchenko@nokia.com>
In-Reply-To: <3fa57fe7152b608279ec56dcfe969a42b672a197.1283760476.git.ext-andriy.shevchenko@nokia.com>
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>
---
drivers/mmc/card/mmc_test.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index cd8edf4..6bffb33 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1937,9 +1937,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)
--
1.6.3.3
next prev parent reply other threads:[~2010-09-06 8:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-06 8:12 [PATCHv5 1/3] mmc_test: use API to check card type Andy Shevchenko
2010-09-06 8:12 ` Andy Shevchenko [this message]
2010-09-06 8:12 ` [PATCHv5 3/3] mmc_test: collect data and show it via sysfs by demand Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59ad4bca0f707b11525dcdbe65dd117d964e4523.1283760476.git.ext-andriy.shevchenko@nokia.com \
--to=ext-andriy.shevchenko@nokia.com \
--cc=adrian.hunter@nokia.com \
--cc=cjb@laptop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®