Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_user_copy.c Create Date:2022-07-28 06:31:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:test_check_nonzero_user

Proto:static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size)

Type:int

Parameter:

TypeParameterName
char *kmem
char __user *umem
size_tsize
49  ret = 0
52  If test(size < 2 * PAGE_SIZE, "buffer too small") Then Return -EINVAL
61  size = 1024
62  start = PAGE_SIZE - size / 2
64  kmem += start
65  umem += start
67  zero_start = size / 4
68  zero_end = size - zero_start
81  memset(kmem, 0x0, size)
82  When i < zero_start cycle kmem[i] = 0xff
84  When i < size cycle kmem[i] = 0xff
87  ret |= test(copy_to_user(umem, kmem, size), "legitimate copy_to_user failed")
90  When start <= size cycle
91  When end <= size cycle
92  len = end - start
96  ret |= test(retval != expected, "check_nonzero_user(=%d) != memchr_inv(=%d) mismatch (start=%zu, end=%zu)", retval, expected, start, end)
102  Return ret
Caller
NameDescribe
test_user_copy_init