Input: evdev - fix evdev_write return value on partial writes
commit439581ec07fa9cf3f519dd461a2cf41cfd3adcb4
authorPeter Korsgaard <jacmet@sunsite.dk>
Fri, 25 Feb 2011 17:30:46 +0000 (25 09:30 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 27 Feb 2011 09:52:53 +0000 (27 01:52 -0800)
tree204e640e88005bfcda1176d28ecc9325fbf57ad3
parent5063511539bbb436ae8e4f75409561ef547f8516
Input: evdev - fix evdev_write return value on partial writes

As was recently brought up on the busybox list
(http://lists.busybox.net/pipermail/busybox/2011-January/074565.html),
evdev_write doesn't properly check the count argument, which will
lead to a return value > count on partial writes if the remaining bytes
are accessible - causing userspace confusion.

Fix it by only handling each full input_event structure and return -EINVAL
if less than 1 struct was written, similar to how it is done in evdev_read.

Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/evdev.c