mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* __user and iov_base
@ 2004-06-14 17:53 Steve French
  2004-06-14 18:30 ` viro
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2004-06-14 17:53 UTC (permalink / raw)
  To: linux-kernel

The commonly used kernel structure iovec includes a field iov_base which
is:
	void __user *iov_base

Unfortunately some of the places that use this are sockets calls from
kernel code in which it would be awkward to do extra memcpy to a user
buffer (from a kernel buffer, perhaps created in a different process)
just to avoid a sparse warning.   Although it works fine to set
	myiovec.iov_base = (char *)some_buffer; 
this generates a warning message in the sparse tool since iov_base
includes the __user modifier, and the kernel buffer you are sending does
not..

If a buffer is never used in user space, and is potentially recycled
(via mempools) for use by more than one process, then it can't be passed
around as an __user buffer, but is it ok to simply do
	myiovec.iov_base = (__user char *)some_buffer; 
or is there another preferred way to handle kernel to __user
mappings/casts?

For the cifs vfs this would eliminate the last sparse warnings. 
	


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: __user and iov_base
  2004-06-14 17:53 __user and iov_base Steve French
@ 2004-06-14 18:30 ` viro
  0 siblings, 0 replies; 2+ messages in thread
From: viro @ 2004-06-14 18:30 UTC (permalink / raw)
  To: Steve French; +Cc: linux-kernel

On Mon, Jun 14, 2004 at 12:53:18PM -0500, Steve French wrote:
> If a buffer is never used in user space, and is potentially recycled
> (via mempools) for use by more than one process, then it can't be passed
> around as an __user buffer, but is it ok to simply do
> 	myiovec.iov_base = (__user char *)some_buffer; 
> or is there another preferred way to handle kernel to __user
> mappings/casts?

Yes - leave them alone.  The warning points to real problem with the
interface; ergo, it should not disappear until there's a clean solution
(if ever).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-14 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-14 17:53 __user and iov_base Steve French
2004-06-14 18:30 ` viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®