Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\read_write.c Create Date:2022-07-28 20:01:22
Last Modify:2020-03-18 10:18:51 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:w_copy_check_uvector() - Copy an array of &struct iovec from userspace* into the kernel and check that it is valid.*@type: One of %CHECK_IOVEC_ONLY, %READ, or %WRITE.*@uvector: Pointer to the userspace array.

Proto:ssize_t rw_copy_check_uvector(int type, const struct iovec __user *uvector, unsigned long nr_segs, unsigned long fast_segs, struct iovec *fast_pointer, struct iovec **ret_pointer)

Type:ssize_t

Parameter:

TypeParameterName
inttype
const struct iovec __user *uvector
unsigned longnr_segs
unsigned longfast_segs
struct iovec *fast_pointer
struct iovec **ret_pointer
771  iov = fast_pointer
778  If nr_segs == 0 Then
779  ret = 0
780  Go to out
787  If nr_segs > UIO_MAXIOV Then
788  ret = -EINVAL
789  Go to out
791  If nr_segs > fast_segs Then
792  iov = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
793  If (iov == NULL) Then
794  ret = -ENOMEM
795  Go to out
798  If copy_from_user(iov, uvector, nr_segs * size of uvector ) Then
799  ret = -EFAULT
800  Go to out
812  ret = 0
813  When seg < nr_segs cycle
814  __user * buf = BSD uses caddr_t (1003.1g requires void *)
815  len = Must be size_t (1003.1g)
819  If len < 0 Then
820  ret = -EINVAL
821  Go to out
825  ret = -EFAULT
826  Go to out
828  If len > MAX_RW_COUNT - ret Then
829  len = MAX_RW_COUNT - ret
832  ret += len
834  out :
835  ret_pointer = iov
836  Return ret
Caller
NameDescribe
import_iovecmport_iovec() - Copy an array of &struct iovec from userspace* into the kernel, check that it is valid, and initialize a new* &struct iov_iter iterator to access it.*@type: One of %READ or %WRITE.*@uvector: Pointer to the userspace array.