Lines Matching refs:ptr

106 static bool overlaps(const unsigned long ptr, unsigned long n,  in overlaps()  argument
109 const unsigned long check_low = ptr; in overlaps()
120 static inline void check_kernel_text_object(const unsigned long ptr, in check_kernel_text_object() argument
127 if (overlaps(ptr, n, textlow, texthigh)) in check_kernel_text_object()
128 usercopy_abort("kernel text", NULL, to_user, ptr - textlow, n); in check_kernel_text_object()
145 if (overlaps(ptr, n, textlow_linear, texthigh_linear)) in check_kernel_text_object()
147 ptr - textlow_linear, n); in check_kernel_text_object()
150 static inline void check_bogus_address(const unsigned long ptr, unsigned long n, in check_bogus_address() argument
154 if (ptr + (n - 1) < ptr) in check_bogus_address()
155 usercopy_abort("wrapped address", NULL, to_user, 0, ptr + n); in check_bogus_address()
158 if (ZERO_OR_NULL_PTR(ptr)) in check_bogus_address()
159 usercopy_abort("null address", NULL, to_user, ptr, n); in check_bogus_address()
162 static inline void check_heap_object(const void *ptr, unsigned long n, in check_heap_object() argument
165 unsigned long addr = (unsigned long)ptr; in check_heap_object()
169 if (is_kmap_addr(ptr)) { in check_heap_object()
170 offset = offset_in_page(ptr); in check_heap_object()
176 if (is_vmalloc_addr(ptr) && !pagefault_disabled()) { in check_heap_object()
189 if (!virt_addr_valid(ptr)) in check_heap_object()
192 folio = virt_to_folio(ptr); in check_heap_object()
196 __check_heap_object(ptr, n, folio_slab(folio), to_user); in check_heap_object()
198 offset = ptr - folio_address(folio); in check_heap_object()
215 void __check_object_size(const void *ptr, unsigned long n, bool to_user) in __check_object_size() argument
222 check_bogus_address((const unsigned long)ptr, n, to_user); in __check_object_size()
225 switch (check_stack_object(ptr, n)) { in __check_object_size()
241 ptr - (void *)current_stack_pointer : in __check_object_size()
242 (void *)current_stack_pointer - ptr, in __check_object_size()
250 check_heap_object(ptr, n, to_user); in __check_object_size()
253 check_kernel_text_object((const unsigned long)ptr, n, to_user); in __check_object_size()