diff options
author | Mike Lockwood <lockwood@android.com> | 2010-04-17 12:01:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-30 20:51:36 +0900 |
commit | 8bfe15f3de0af92fd822b7475878bddc93fa490d (patch) | |
tree | 84f492cb22f6fde989989c8739a748dd387d57d0 | |
parent | 16b665543864904714f028b1d349f5d905f39afb (diff) | |
download | op-kernel-dev-8bfe15f3de0af92fd822b7475878bddc93fa490d.zip op-kernel-dev-8bfe15f3de0af92fd822b7475878bddc93fa490d.tar.gz |
Staging: android: timed_gpio: Properly discard invalid timeout values.
The timed output device never previously checked the return value of sscanf,
resulting in an uninitialized int being passed to enable() if input value
was invalid.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/android/timed_output.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index 62e7918..f373422 100644 --- a/drivers/staging/android/timed_output.c +++ b/drivers/staging/android/timed_output.c @@ -41,7 +41,9 @@ static ssize_t enable_store( struct timed_output_dev *tdev = dev_get_drvdata(dev); int value; - sscanf(buf, "%d", &value); + if (sscanf(buf, "%d", &value) != 1) + return -EINVAL; + tdev->enable(tdev, value); return size; |