Skip to content

Commit

Permalink
Staging: android: timed_gpio: Properly discard invalid timeout values.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Lockwood authored and Greg Kroah-Hartman committed Nov 30, 2011
1 parent 16b6655 commit 8bfe15f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/android/timed_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8bfe15f

Please sign in to comment.