Commit 8bfe15f3 authored by Mike Lockwood's avatar Mike Lockwood Committed by Greg Kroah-Hartman

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: default avatarMike Lockwood <lockwood@android.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 16b66554
...@@ -41,7 +41,9 @@ static ssize_t enable_store( ...@@ -41,7 +41,9 @@ static ssize_t enable_store(
struct timed_output_dev *tdev = dev_get_drvdata(dev); struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value; int value;
sscanf(buf, "%d", &value); if (sscanf(buf, "%d", &value) != 1)
return -EINVAL;
tdev->enable(tdev, value); tdev->enable(tdev, value);
return size; return size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment