summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Miguel Silva <rmfrfs@gmail.com>2016-09-30 18:24:33 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-02 13:49:26 (GMT)
commitdc875c77900dba5d177f9219492fd60c046feec8 (patch)
tree0a4e1543bbd3facabbdf49b7e57d9f0624a33aab
parent3855eeec1a47cace93acd5ff89fb3c9bd593d307 (diff)
downloadlinux-dc875c77900dba5d177f9219492fd60c046feec8.tar.xz
staging: greybus: light: check delay_{on|off} before use
Even though we trust leds core that the pointers should be valid, we are safer to check delay_{on|off} before use. Also, this avoid a smatch warning: drivers/staging/greybus/light.c:484 gb_blink_set() warn: variable dereferenced before check 'delay_on' (see line 476) Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/greybus/light.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index f3cd485..80dc4a9 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -463,6 +463,9 @@ static int gb_blink_set(struct led_classdev *cdev, unsigned long *delay_on,
if (channel->releasing)
return -ESHUTDOWN;
+ if (!delay_on || !delay_off)
+ return -EINVAL;
+
mutex_lock(&channel->lock);
ret = gb_pm_runtime_get_sync(bundle);
if (ret < 0)