/* Save time not doing access_ok. copy_*_user will make this work in any case.  */
int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode)
/* Save time not doing access_ok. copy_*_user will make this work in any case.  */
int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode)
{
	int size, err, ct;
	if (m->msg_namelen) {
		if (mode == VERIFY_READ) {
			err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
						  address);
			if (err < 0)
				return err;
		}
		m->msg_name = address;
	} else {
		m->msg_name = NULL;
	}
	size = m->msg_iovlen * sizeof(struct iovec);
	if (copy_from_user(iov, m->msg_iov, size))
		return -EFAULT;
	m->msg_iov = iov;
	err = 0;
	for (ct = 0; ct < m->msg_iovlen; ct++) {
		err += iov[ct].iov_len;
		if (err < 0)
			return -EMSGSIZE;
	}
	return err;
}