From 2fd62fb317e4b37af8b9f254acc1dca8a047488f Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Sat, 17 Apr 2010 12:01:35 -0400 Subject: [PATCH] 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 --- drivers/staging/android/timed_output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index 62e79180421b..f373422308e0 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; -- 2.34.1