]> asedeno.scripts.mit.edu Git - linux.git/commit
gpio: mockup: improve the debugfs input sanitization
authorBartosz Golaszewski <brgl@bgdev.pl>
Fri, 9 Jun 2017 11:41:25 +0000 (13:41 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 20 Jun 2017 07:18:33 +0000 (09:18 +0200)
commit6f9b3e776d171636ccafbcb39a8210b4fa37136b
tree7a600dde36983da45a92aa5c1bfe573652e9647d
parentb6730b20837e7402292d35d3cb910fff4dac7099
gpio: mockup: improve the debugfs input sanitization

We're currently only checking the first character of the input to the
debugfs event files, so a string like '0sdfdsf' is valid and indicates
a falling edge event.

Be more strict and only allow '0', '1', '0\n' & '1\n'.

While we're at it: move the sanitization code before the irq_enabled
check so that we indicate an error on invalid input even if nobody is
waiting for events.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mockup.c