Re: [PATCH 2/2] uinput: Support injecting multiple events in one write() call

Dmitry Torokhov
2013-09-18T19:48:13Z

Hi Ryan,

On Wed, Sep 18, 2013 at 08:55:44AM +1000, Ryan Mallon wrote:
> Rework the code in uinput_inject_event so that it matches the code in
> evdev_write and allows injecting more than one event, or zero events.

After some thinking I went back to the original version of your patch.
For justification see 46f49b7a223ac7493e7cf619fb583d11edefc2c2:

"When copy_to/from_user fails in the middle of transfer we should not
report to the user that read/write partially succeeded but rather
report -EFAULT right away, so that application will know that it got
its buffers all wrong.

If application messed up its buffers we can't trust the data fetched
from userspace and successfully written to the device or if data read
from the device and transferred to userspace ended up where application
expected it to end."

Thanks.

--
Dmitry