Lines Matching refs:ptr
102 /* Returns true if any portion of [ptr,ptr+n) over laps with [low,high). */
103 static bool overlaps(const unsigned long ptr, unsigned long n,
106 const unsigned long check_low = ptr;
117 static inline void check_kernel_text_object(const unsigned long ptr,
124 if (overlaps(ptr, n, textlow, texthigh))
125 usercopy_abort("kernel text", NULL, to_user, ptr - textlow, n);
142 if (overlaps(ptr, n, textlow_linear, texthigh_linear))
144 ptr - textlow_linear, n);
147 static inline void check_bogus_address(const unsigned long ptr, unsigned long n,
151 if (ptr + (n - 1) < ptr)
152 usercopy_abort("wrapped address", NULL, to_user, 0, ptr + n);
155 if (ZERO_OR_NULL_PTR(ptr))
156 usercopy_abort("null address", NULL, to_user, ptr, n);
160 static inline void check_page_span(const void *ptr, unsigned long n,
164 const void *end = ptr + n - 1;
175 if (ptr >= (const void *)__start_rodata &&
183 if (ptr >= (const void *)_sdata && end <= (const void *)_edata)
187 if (ptr >= (const void *)__bss_start &&
192 if (likely(((unsigned long)ptr & (unsigned long)PAGE_MASK) ==
211 for (ptr += PAGE_SIZE; ptr <= end; ptr += PAGE_SIZE) {
212 page = virt_to_head_page(ptr);
223 static inline void check_heap_object(const void *ptr, unsigned long n,
228 if (!virt_addr_valid(ptr))
236 page = compound_head(kmap_to_page((void *)ptr));
240 __check_heap_object(ptr, n, page, to_user);
243 check_page_span(ptr, n, page, to_user);
256 void __check_object_size(const void *ptr, unsigned long n, bool to_user)
266 check_bogus_address((const unsigned long)ptr, n, to_user);
269 switch (check_stack_object(ptr, n)) {
286 check_heap_object(ptr, n, to_user);
289 check_kernel_text_object((const unsigned long)ptr, n, to_user);