__user and iov_base

From: Steve French
Date: Mon Jun 14 2004 - 12:56:23 EST


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.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/