diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-07-29 22:48:31 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-08-21 22:29:53 -0700 |
commit | f40033acc2d14acecd1b27a79dc8a0ad437e619a (patch) | |
tree | 2be8d3a335f0d2a0b28d099bf41ffbba836246d5 /samples | |
parent | 929d1af5478dec82903e05aa9662a4ec12ad655b (diff) |
Input: uinput - return -EINVAL when read buffer size is too small
Let's check whether the user-supplied buffer is actually big enough and
return -EINVAL if it is not. This differs from current behavior, which
caused 0 to be returned and actually does not make any sense, as
broken application will simply repeat the read getting into endless
loop.
Note that we treat 0 as a special case, according to the standard:
"Before any action described below is taken, and if nbyte is zero,
the read() function may detect and return errors as described below.
In the absence of errors, or if error detection is not performed,
the read() function shall return zero and have no other results."
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions