linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sumit Pundir <pundirsumit11@gmail.com>
To: gregkh@linuxfoundation.org
Cc: neil@brown.name, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	Sumit Pundir <pundirsumit11@gmail.com>
Subject: [PATCH] staging: mt7621-mmc: place a check for sscanf
Date: Fri, 10 Aug 2018 18:01:40 +0530	[thread overview]
Message-ID: <20180810123140.19821-1-pundirsumit11@gmail.com> (raw)

Placed a check for the return value of sscanf. -EINVAL is returned if
the value is anything other than expected. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
---
 drivers/staging/mt7621-mmc/dbg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c
index 6e518dce9029..4fe4d2fd111e 100644
--- a/drivers/staging/mt7621-mmc/dbg.c
+++ b/drivers/staging/mt7621-mmc/dbg.c
@@ -249,7 +249,9 @@ static ssize_t msdc_debug_proc_write(struct file *file,
 	cmd_buf[count] = '\0';
 	pr_debug("msdc Write %s\n", cmd_buf);
 
-	sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2);
+	ret = sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2);
+	if (ret != 3)
+		return -EINVAL;
 
 	if (cmd == SD_TOOL_ZONE) {
 		id = p1;
-- 
2.17.1


                 reply	other threads:[~2018-08-10 12:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180810123140.19821-1-pundirsumit11@gmail.com \
    --to=pundirsumit11@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    /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;
as well as URLs for NNTP newsgroup(s).