On Thu, May 30, 2002 at 04:36:22PM +0200, Emmanuel Michon wrote:
> I'm working with linux-2.4.18, and writing some
> trivial code to get from kernel a grabbed image working this way:
> What I get actually is only 4K filled in userland, but copy_to_user
> returns IMSIZE!
copy_to_user() returns the number of bytes NOT copied.
same for copy_from_user().
This is a common mistake and your code using this functions should
look like this:
if (copy_from_user(to,uptr,size)) {
return -EFAULT;
}
/* Do some processing */
if (copy_to_user(uptr,from,size)) {
return -EFAULT;
}
PS: CC'ed linux-kernel, that you will not get 1000 answers ;-)
Regards
Ingo Oeser
-- Science is what we can tell a computer. Art is everything else. --- D.E.Knuth - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/