Thread (23 messages) 23 messages, 5 authors, 2014-01-12

Re: [PATCH 2/4] Input: introduce ABS_MAX2/CNT2 and friends

flat view

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2013-12-18 23:48:42
Also in: lkml

On Thursday, December 19, 2013 09:40:09 AM Peter Hutterer wrote:
quoted
+     memset(&abs, 0, sizeof(abs));
+     for (i = valid_cnt; i < cnt; ++i)
+             if (copy_to_user(&pinfo->info[i], &abs, sizeof(abs)))
+                     return -EFAULT;
+
+     return 0;
why don't you return the number of valid copied axes to the user?
that seems better even than forcing the remainder to 0.
Well, if your program messed up buffers that it faulted we do not know
for sure if data that did not cause fault ended up where it should have
or if it smashed something else. This condition I think should be
signaled early.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help