On 22 May 00 at 21:50, Tigran Aivazian wrote:
> > What appears to be a problem?
> ok, ok, I see what you are saying - will copying a byte at a time like
> Manfred suggested work for stuff passed on the stack?
Yes. You can even:
...
i = copy_from_user(arg, kernel, PAGE_SIZE);
if (i == PAGE_SIZE) {
for (i = 0; i < PAGE_SIZE; i++)
if (get_user(arg++, kernel++))
break;
i = PAGE_SIZE - i;
}
if (i)
memset(kernel + PAGE_SIZE - i, 0, i);
...
If parameter is not in the top 4KB of user memory, task will be done
with fast copy_from_user. Only if it completely fails (either completely
bogus pointer or end-of-user memory problem), code will switch into
byte-by-byte copy. Of course, such thing requires comment in source
so that nobody will remove it again :-)
Petr Vandrovec
vandrove@vc.cvut.cz
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:22 EST