mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* backlight: catch invalid input
@ 2008-11-21 11:14 Pavel Machek
  2008-11-21 23:54 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2008-11-21 11:14 UTC (permalink / raw)
  To: rpurdie, kernel list, Andrew Morton


Currently, echo > brightness turns brightness to zero due to
insufficient checking. Add a test to catch that.

Signed-off-by: Pavel Machek <pavel@suse.cz>

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index fab0bc8..5c2e23d 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -86,6 +86,8 @@ static ssize_t backlight_store_power(str
 	int power = simple_strtoul(buf, &endp, 0);
 	size_t size = endp - buf;
 
+	if (!size)
+		return -EINVAL;
 	if (*endp && isspace(*endp))
 		size++;
 	if (size != count)


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-22 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-21 11:14 backlight: catch invalid input Pavel Machek
2008-11-21 23:54 ` Andrew Morton
2008-11-22 10:37   ` Pavel Machek
2008-11-22 20:31   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®