Lines Matching refs:size
42 static bool is_zeroed(void *from, size_t size) in is_zeroed() argument
44 return memchr_inv(from, 0x0, size) == NULL; in is_zeroed()
47 static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size) in test_check_nonzero_user() argument
52 if (test(size < 2 * PAGE_SIZE, "buffer too small")) in test_check_nonzero_user()
61 size = 1024; in test_check_nonzero_user()
62 start = PAGE_SIZE - (size / 2); in test_check_nonzero_user()
67 zero_start = size / 4; in test_check_nonzero_user()
68 zero_end = size - zero_start; in test_check_nonzero_user()
81 memset(kmem, 0x0, size); in test_check_nonzero_user()
84 for (i = zero_end; i < size; i += 2) in test_check_nonzero_user()
87 ret |= test(copy_to_user(umem, kmem, size), in test_check_nonzero_user()
90 for (start = 0; start <= size; start++) { in test_check_nonzero_user()
91 for (end = start; end <= size; end++) { in test_check_nonzero_user()
106 size_t size) in test_copy_struct_from_user() argument
112 umem_src = kmalloc(size, GFP_KERNEL); in test_copy_struct_from_user()
117 expected = kmalloc(size, GFP_KERNEL); in test_copy_struct_from_user()
123 memset(umem_src, 0x3e, size); in test_copy_struct_from_user()
124 ret |= test(copy_to_user(umem, umem_src, size), in test_copy_struct_from_user()
128 ksize = size; in test_copy_struct_from_user()
129 usize = size; in test_copy_struct_from_user()
133 memset(kmem, 0x0, size); in test_copy_struct_from_user()
140 ksize = size; in test_copy_struct_from_user()
141 usize = size / 2; in test_copy_struct_from_user()
146 memset(kmem, 0x0, size); in test_copy_struct_from_user()
153 ksize = size / 2; in test_copy_struct_from_user()
154 usize = size; in test_copy_struct_from_user()
156 memset(kmem, 0x0, size); in test_copy_struct_from_user()
161 ksize = size / 2; in test_copy_struct_from_user()
162 usize = size; in test_copy_struct_from_user()
168 memset(kmem, 0x0, size); in test_copy_struct_from_user()
222 #define test_legit(size, check) \ in test_user_copy_init() argument
224 val_##size = check; \ in test_user_copy_init()
225 ret |= test(put_user(val_##size, (size __user *)usermem), \ in test_user_copy_init()
226 "legitimate put_user (" #size ") failed"); \ in test_user_copy_init()
227 val_##size = 0; \ in test_user_copy_init()
228 ret |= test(get_user(val_##size, (size __user *)usermem), \ in test_user_copy_init()
229 "legitimate get_user (" #size ") failed"); \ in test_user_copy_init()
230 ret |= test(val_##size != check, \ in test_user_copy_init()
231 "legitimate get_user (" #size ") failed to do copy"); \ in test_user_copy_init()
232 if (val_##size != check) { \ in test_user_copy_init()
234 (unsigned long long)val_##size, \ in test_user_copy_init()
287 #define test_illegal(size, check) \ in test_user_copy_init() argument
289 val_##size = (check); \ in test_user_copy_init()
290 ret |= test(!get_user(val_##size, (size __user *)kmem), \ in test_user_copy_init()
291 "illegal get_user (" #size ") passed"); \ in test_user_copy_init()
292 ret |= test(val_##size != (size)0, \ in test_user_copy_init()
293 "zeroing failure for illegal get_user (" #size ")"); \ in test_user_copy_init()
294 if (val_##size != (size)0) { \ in test_user_copy_init()
296 (unsigned long long)val_##size); \ in test_user_copy_init()
298 ret |= test(!put_user(val_##size, (size __user *)kmem), \ in test_user_copy_init()
299 "illegal put_user (" #size ") passed"); \ in test_user_copy_init()