From: Gargi Sharma <gs051095@gmail.com>
To: outreachy-kernel@googlegroups.com
Cc: w.d.hubbs@gmail.com, chris@the-brannons.com, kirk@reisers.ca,
samuel.thibault@ens-lyon.org, gregkh@linuxfoundation.org,
Gargi Sharma <gs051095@gmail.com>
Subject: [PATCH v2] staging: speakup: replace simple_strtoul by kstrtoul
Date: Tue, 13 Sep 2016 19:02:12 +0530 [thread overview]
Message-ID: <20160913133212.7830-1-gs051095@gmail.com> (raw)
Making changes to add a check to the value returned by kstrtoul. Also,
updating temp since it is being used afterwards.
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
drivers/staging/speakup/kobjects.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 884b2eb..e42be0f 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -154,7 +154,13 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
continue;
}
- err = kstrtoul(cp, 10, &index);
+ temp = cp;
+ err = kstrtoul(temp, 10, &index);
+ if (err < 0) {
+ retval = err;
+ break;
+ }
+
if (index > 255) {
rejected++;
cp = linefeed + 1;
@@ -785,7 +791,12 @@ static ssize_t message_store_helper(const char *buf, size_t count,
continue;
}
- err = kstrtoul(cp, 10, &index);
+ temp = cp;
+ err = kstrtoul(temp, 10, &index);
+ if (err < 0) {
+ retval = err;
+ break;
+ }
while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
temp++;
--
2.9.2
next reply other threads:[~2016-09-13 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 13:32 Gargi Sharma [this message]
2016-09-13 14:17 ` [Outreachy kernel] [PATCH v2] staging: speakup: replace simple_strtoul by kstrtoul Julia Lawall
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=20160913133212.7830-1-gs051095@gmail.com \
--to=gs051095@gmail.com \
--cc=chris@the-brannons.com \
--cc=gregkh@linuxfoundation.org \
--cc=kirk@reisers.ca \
--cc=outreachy-kernel@googlegroups.com \
--cc=samuel.thibault@ens-lyon.org \
--cc=w.d.hubbs@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.