[PATCH] drivers, video: Add a check for strict_strtoul()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Liu Yuan <tailai.ly@xxxxxxxxxx>

It should check if strict_strtoul() succeeds.This
patch fixes it.

Signed-off-by: Liu Yuan <tailai.ly@xxxxxxxxxx>
---
 drivers/video/backlight/adp5520_bl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index af31197..fdef632 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -212,7 +212,9 @@ static ssize_t adp5520_bl_daylight_max_store(struct device *dev,
 {
 	struct adp5520_bl *data = dev_get_drvdata(dev);
 
-	strict_strtoul(buf, 10, &data->cached_daylight_max);
+	if (strict_strtoul(buf, 10, &data->cached_daylight_max) < 0)
+		return -EINVAL;
+
 	return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX);
 }
 static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux