On Wed, Dec 18, 2013 at 03:48:37PM -0800, Dmitry Torokhov wrote: > On Thursday, December 19, 2013 09:40:09 AM Peter Hutterer wrote: > > > + 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. not 100% sure I understand but I wasn't proposing to remove the -EFAULT, i was proposing to replace "return 0" with "return valid_cnt". Cheers, Peter -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html