diff options
author | Roberta Dobrescu <roberta.dobrescu@gmail.com> | 2014-09-20 00:01:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-19 17:25:23 -0700 |
commit | fb33aa47a00edc789d17d80174cd3ed8a1c82c66 (patch) | |
tree | aa79af9f900319c54c03d3b3d635a23375e273fe /drivers/staging/dgnc | |
parent | f23e875fd26a05a0850db7c5e090030c80b4f583 (diff) |
staging: dgnc: Check sscanf return value
This fixes the following checkpatch.pl warnings:
WARNING: unchecked sscanf return value
Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dgnc')
-rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 207fa25cb7da..0d425ada0001 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -70,7 +70,11 @@ static ssize_t dgnc_driver_debug_show(struct device_driver *ddp, char *buf) static ssize_t dgnc_driver_debug_store(struct device_driver *ddp, const char *buf, size_t count) { - sscanf(buf, "0x%x\n", &dgnc_debug); + int ret; + + ret = sscanf(buf, "0x%x\n", &dgnc_debug); + if (ret != 1) + return -EINVAL; return count; } static DRIVER_ATTR(debug, (S_IRUSR | S_IWUSR), dgnc_driver_debug_show, dgnc_driver_debug_store); @@ -83,7 +87,11 @@ static ssize_t dgnc_driver_rawreadok_show(struct device_driver *ddp, char *buf) static ssize_t dgnc_driver_rawreadok_store(struct device_driver *ddp, const char *buf, size_t count) { - sscanf(buf, "0x%x\n", &dgnc_rawreadok); + int ret; + + ret = sscanf(buf, "0x%x\n", &dgnc_rawreadok); + if (ret != 1) + return -EINVAL; return count; } static DRIVER_ATTR(rawreadok, (S_IRUSR | S_IWUSR), dgnc_driver_rawreadok_show, dgnc_driver_rawreadok_store); @@ -96,7 +104,11 @@ static ssize_t dgnc_driver_pollrate_show(struct device_driver *ddp, char *buf) static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, const char *buf, size_t count) { - sscanf(buf, "%d\n", &dgnc_poll_tick); + int ret; + + ret = sscanf(buf, "%d\n", &dgnc_poll_tick); + if (ret != 1) + return -EINVAL; return count; } static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, dgnc_driver_pollrate_store); |