lkml.org 
[lkml]   [2004]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Copy_to_user and copy_from_user
Date

Then, how do I make sure that all the data I wanted to be copied is infact
copied?? What are the scenarios where copy_to/from_user could fail and how
can I avoid it.

Thanks
-Ramesh


>
>No you cannot call it until all data has been copied. copy_{to,from}_user
>fails when a fault happens during the copy process. So you simply cannot
>try again... It will fault again.
>Well, not 100% true. An other running thread (same mm with the process
>which copies data) can "fix" the faulty adress space. Bad thread....
>
>Ramesh Sudini wrote:
>>Hi,
>>
>>If copy_from_user returns non zero value, then I do not see any driver(for
>>example PPP) try to copy the remaining data. It treats it as an error
>>scenario.
>>
>>Why is this? Shouldnt it have a while loop and attempt to copy_from_user
>>till all the data is copied??
>>
>>I am writing a driver and trying to understand what needs to be done in
>>case it returns a non-zero value? I have huge amount of data to be copied
>>from user space Ex: 3000byte messages.
>>
>>Can somebody suggest me what is the best I could do...(Please cc me
>>personally with your response)
>>
>>Thanks
>>Ramesh
>>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-
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/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:1.212 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site