Re: user_memcpy()

Ingo Weinhold <bonefish-CFLBMwTPW48UNGrzBIF7/[email protected]>
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <Pine.GSO.4.60.0504291433170.9496@bolero>
On Fri, 29 Apr 2005, Axel Dörfler wrote:

> François Revol made me recognize a design flaw in our user_memcpy()/
> user_strlcpy() API: you have to check the validity of the user address
> yourself, ie. you have to make sure it's in user space.
> But we don't have a function for this, just the (kernel private) macro
> IS_USER_ADDRESS().
>
> And while I like to keep the macro, we should at least export an
> is_user_address() function.
>
> But that would still open a possible source of errors - as you still
> have to check the address yourself. François suggested to do something
> similar than Linux that has copy_to_user() and copy_from_user()
> functions.
> Since we also have a user_strlcpy() function, I would suggest the
> following:
> 	copy_to_user()
> 	copy_from_user()
> 	strlcpy_to_user()
> 	strlcpy_from_user()
> 	user_memset() - or memset_user()?
>
> Any preferences?

Sounds good, save that I would probably call the first two 
memcpy_{from,to}_user(). I wonder if we might also want to have versions 
that copy between user addresses.

CU, Ingo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.