Lines Matching refs:size
56 unsigned long size) in memory_is_poisoned_2_4_8() argument
64 if (unlikely((((unsigned long)addr + size - 1) & KASAN_GRANULE_MASK) < size - 1)) in memory_is_poisoned_2_4_8()
65 return *shadow_addr || memory_is_poisoned_1(addr + size - 1); in memory_is_poisoned_2_4_8()
67 return memory_is_poisoned_1(addr + size - 1); in memory_is_poisoned_2_4_8()
82 size_t size) in bytes_is_nonzero() argument
84 while (size) { in bytes_is_nonzero()
88 size--; in bytes_is_nonzero()
123 static __always_inline bool memory_is_poisoned_n(const void *addr, size_t size) in memory_is_poisoned_n() argument
128 kasan_mem_to_shadow(addr + size - 1) + 1); in memory_is_poisoned_n()
131 const void *last_byte = addr + size - 1; in memory_is_poisoned_n()
142 static __always_inline bool memory_is_poisoned(const void *addr, size_t size) in memory_is_poisoned() argument
144 if (__builtin_constant_p(size)) { in memory_is_poisoned()
145 switch (size) { in memory_is_poisoned()
151 return memory_is_poisoned_2_4_8(addr, size); in memory_is_poisoned()
159 return memory_is_poisoned_n(addr, size); in memory_is_poisoned()
163 size_t size, bool write, in check_region_inline() argument
169 if (unlikely(size == 0)) in check_region_inline()
172 if (unlikely(addr + size < addr)) in check_region_inline()
173 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
176 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
178 if (likely(!memory_is_poisoned(addr, size))) in check_region_inline()
181 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
184 bool kasan_check_range(const void *addr, size_t size, bool write, in kasan_check_range() argument
187 return check_region_inline(addr, size, write, ret_ip); in kasan_check_range()
215 size_t aligned_size = round_up(global->size, KASAN_GRANULE_SIZE); in register_global()
217 kasan_unpoison(global->beg, global->size, false); in register_global()
224 void __asan_register_globals(void *ptr, ssize_t size) in __asan_register_globals() argument
229 for (i = 0; i < size; i++) in __asan_register_globals()
234 void __asan_unregister_globals(void *ptr, ssize_t size) in __asan_unregister_globals() argument
239 #define DEFINE_ASAN_LOAD_STORE(size) \ argument
240 void __asan_load##size(void *addr) \
242 check_region_inline(addr, size, false, _RET_IP_); \
244 EXPORT_SYMBOL(__asan_load##size); \
245 __alias(__asan_load##size) \
246 void __asan_load##size##_noabort(void *); \
247 EXPORT_SYMBOL(__asan_load##size##_noabort); \
248 void __asan_store##size(void *addr) \
250 check_region_inline(addr, size, true, _RET_IP_); \
252 EXPORT_SYMBOL(__asan_store##size); \
253 __alias(__asan_store##size) \
254 void __asan_store##size##_noabort(void *); \
255 EXPORT_SYMBOL(__asan_store##size##_noabort)
263 void __asan_loadN(void *addr, ssize_t size) in __asan_loadN() argument
265 kasan_check_range(addr, size, false, _RET_IP_); in __asan_loadN()
273 void __asan_storeN(void *addr, ssize_t size) in __asan_storeN() argument
275 kasan_check_range(addr, size, true, _RET_IP_); in __asan_storeN()
288 void __asan_alloca_poison(void *addr, ssize_t size) in __asan_alloca_poison() argument
290 size_t rounded_up_size = round_up(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
291 size_t padding_size = round_up(size, KASAN_ALLOCA_REDZONE_SIZE) - in __asan_alloca_poison()
293 size_t rounded_down_size = round_down(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
302 size - rounded_down_size, false); in __asan_alloca_poison()
322 void __asan_set_shadow_##byte(const void *addr, ssize_t size) \
324 __memset((void *)addr, 0x##byte, size); \
359 void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, in kasan_cache_create() argument
379 ok_size = *size; in kasan_cache_create()
382 cache->kasan_info.alloc_meta_offset = *size; in kasan_cache_create()
383 *size += sizeof(struct kasan_alloc_meta); in kasan_cache_create()
391 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
393 *size = ok_size; in kasan_cache_create()
409 ok_size = *size; in kasan_cache_create()
411 cache->kasan_info.free_meta_offset = *size; in kasan_cache_create()
412 *size += sizeof(struct kasan_free_meta); in kasan_cache_create()
415 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
417 *size = ok_size; in kasan_cache_create()
427 if (*size < optimal_size) in kasan_cache_create()
428 *size = optimal_size; in kasan_cache_create()