Lines Matching refs:kmem
47 static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size) in test_check_nonzero_user() argument
64 kmem += start; in test_check_nonzero_user()
81 memset(kmem, 0x0, size); in test_check_nonzero_user()
83 kmem[i] = 0xff; in test_check_nonzero_user()
85 kmem[i] = 0xff; in test_check_nonzero_user()
87 ret |= test(copy_to_user(umem, kmem, size), in test_check_nonzero_user()
94 int expected = is_zeroed(kmem + start, len); in test_check_nonzero_user()
105 static int test_copy_struct_from_user(char *kmem, char __user *umem, in test_copy_struct_from_user() argument
133 memset(kmem, 0x0, size); in test_copy_struct_from_user()
134 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), in test_copy_struct_from_user()
136 ret |= test(memcmp(kmem, expected, ksize), in test_copy_struct_from_user()
146 memset(kmem, 0x0, size); in test_copy_struct_from_user()
147 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), in test_copy_struct_from_user()
149 ret |= test(memcmp(kmem, expected, ksize), in test_copy_struct_from_user()
156 memset(kmem, 0x0, size); in test_copy_struct_from_user()
157 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize) != -E2BIG, in test_copy_struct_from_user()
168 memset(kmem, 0x0, size); in test_copy_struct_from_user()
169 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), in test_copy_struct_from_user()
171 ret |= test(memcmp(kmem, expected, ksize), in test_copy_struct_from_user()
183 char *kmem; in test_user_copy_init() local
194 kmem = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); in test_user_copy_init()
195 if (!kmem) in test_user_copy_init()
203 kfree(kmem); in test_user_copy_init()
213 memset(kmem, 0x3a, PAGE_SIZE * 2); in test_user_copy_init()
214 ret |= test(copy_to_user(usermem, kmem, PAGE_SIZE), in test_user_copy_init()
216 memset(kmem, 0x0, PAGE_SIZE); in test_user_copy_init()
217 ret |= test(copy_from_user(kmem, usermem, PAGE_SIZE), in test_user_copy_init()
219 ret |= test(memcmp(kmem, kmem + PAGE_SIZE, PAGE_SIZE), in test_user_copy_init()
248 ret |= test_check_nonzero_user(kmem, usermem, 2 * PAGE_SIZE); in test_user_copy_init()
250 ret |= test_copy_struct_from_user(kmem, usermem, 2 * PAGE_SIZE); in test_user_copy_init()
257 memset(kmem, 0x5a, PAGE_SIZE); in test_user_copy_init()
258 memset(kmem + PAGE_SIZE, 0, PAGE_SIZE); in test_user_copy_init()
261 ret |= test(!copy_from_user(kmem, (char __user *)(kmem + PAGE_SIZE), in test_user_copy_init()
266 ret |= test(memcmp(kmem + PAGE_SIZE, kmem, PAGE_SIZE), in test_user_copy_init()
276 ret |= test(!copy_from_user(bad_usermem, (char __user *)kmem, in test_user_copy_init()
280 ret |= test(!copy_to_user((char __user *)kmem, kmem + PAGE_SIZE, in test_user_copy_init()
283 ret |= test(!copy_to_user((char __user *)kmem, bad_usermem, in test_user_copy_init()
290 ret |= test(!get_user(val_##size, (size __user *)kmem), \ in test_user_copy_init()
298 ret |= test(!put_user(val_##size, (size __user *)kmem), \ in test_user_copy_init()
311 kfree(kmem); in test_user_copy_init()