Re: copy_mount_options in 2.3.99-pre9-pre3 and ncpmount (an

From: Brian Gerst (bgerst@quark.vpplus.com)
Date: Mon May 22 2000 - 16:42:29 EST


Petr Vandrovec wrote:
> 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 :-)

No need to reinvent the wheel... just take a look at do_getname().

--

Brian Gerst

- 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