From: Liu Yuan Date: Wed, 25 May 2011 00:11:12 +0000 (-0700) Subject: drivers/video/backlight/adp5520_bl.c: check strict_strtoul() return value X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=877947bc25af5964f282dea112d24934050cc7b1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drivers/video/backlight/adp5520_bl.c: check strict_strtoul() return value It should check if strict_strtoul() succeeds. [akpm@linux-foundation.org: don't override strict_strtoul() return value] Signed-off-by: Liu Yuan Acked-by: Michael Hennerich Cc: Richard Purdie Cc: Paul Mundt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index af3119707dbf..d1aee730d7d8 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -211,8 +211,12 @@ static ssize_t adp5520_bl_daylight_max_store(struct device *dev, const char *buf, size_t count) { struct adp5520_bl *data = dev_get_drvdata(dev); + int ret; + + ret = strict_strtoul(buf, 10, &data->cached_daylight_max); + if (ret < 0) + return ret; - strict_strtoul(buf, 10, &data->cached_daylight_max); return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX); } static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show,