Lines Matching refs:ptr
105 /* Returns true if any portion of [ptr,ptr+n) over laps with [low,high). */
106 static bool overlaps(const unsigned long ptr, unsigned long n,
109 const unsigned long check_low = ptr;
120 static inline void check_kernel_text_object(const unsigned long ptr,
127 if (overlaps(ptr, n, textlow, texthigh))
128 usercopy_abort("kernel text", NULL, to_user, ptr - textlow, n);
145 if (overlaps(ptr, n, textlow_linear, texthigh_linear))
147 ptr - textlow_linear, n);
150 static inline void check_bogus_address(const unsigned long ptr, unsigned long n,
154 if (ptr + (n - 1) < ptr)
155 usercopy_abort("wrapped address", NULL, to_user, 0, ptr + n);
158 if (ZERO_OR_NULL_PTR(ptr))
159 usercopy_abort("null address", NULL, to_user, ptr, n);
162 static inline void check_heap_object(const void *ptr, unsigned long n,
165 unsigned long addr = (unsigned long)ptr;
169 if (is_kmap_addr(ptr)) {
170 offset = offset_in_page(ptr);
176 if (is_vmalloc_addr(ptr) && !pagefault_disabled()) {
189 if (!virt_addr_valid(ptr))
192 folio = virt_to_folio(ptr);
196 __check_heap_object(ptr, n, folio_slab(folio), to_user);
198 offset = ptr - folio_address(folio);
213 void __check_object_size(const void *ptr, unsigned long n, bool to_user)
223 check_bogus_address((const unsigned long)ptr, n, to_user);
226 switch (check_stack_object(ptr, n)) {
242 ptr - (void *)current_stack_pointer :
243 (void *)current_stack_pointer - ptr,
251 check_heap_object(ptr, n, to_user);
254 check_kernel_text_object((const unsigned long)ptr, n, to_user);