diff options
| author | Sumit Pundir <[email protected]> | 2018-08-10 18:01:40 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2018-08-27 19:31:59 +0200 |
| commit | b9e50d0cfd32274df6a057a59cb0695ae828fa2b (patch) | |
| tree | 4ff78b78b954fcd9f327877a2af64adb57b2790e | |
| parent | fff12fcd60d0dff7ea84825d6086306abebc652c (diff) | |
staging: mt7621-mmc: place a check for sscanf
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | drivers/staging/mt7621-mmc/dbg.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |