Lines Matching refs:size
58 unsigned long size) in memory_is_poisoned_2_4_8() argument
66 if (unlikely((((unsigned long)addr + size - 1) & KASAN_GRANULE_MASK) < size - 1)) in memory_is_poisoned_2_4_8()
67 return *shadow_addr || memory_is_poisoned_1(addr + size - 1); in memory_is_poisoned_2_4_8()
69 return memory_is_poisoned_1(addr + size - 1); in memory_is_poisoned_2_4_8()
84 size_t size) in bytes_is_nonzero() argument
86 while (size) { in bytes_is_nonzero()
90 size--; in bytes_is_nonzero()
125 static __always_inline bool memory_is_poisoned_n(const void *addr, size_t size) in memory_is_poisoned_n() argument
130 kasan_mem_to_shadow(addr + size - 1) + 1); in memory_is_poisoned_n()
133 const void *last_byte = addr + size - 1; in memory_is_poisoned_n()
144 static __always_inline bool memory_is_poisoned(const void *addr, size_t size) in memory_is_poisoned() argument
146 if (__builtin_constant_p(size)) { in memory_is_poisoned()
147 switch (size) { in memory_is_poisoned()
153 return memory_is_poisoned_2_4_8(addr, size); in memory_is_poisoned()
161 return memory_is_poisoned_n(addr, size); in memory_is_poisoned()
165 size_t size, bool write, in check_region_inline() argument
171 if (unlikely(size == 0)) in check_region_inline()
174 if (unlikely(addr + size < addr)) in check_region_inline()
175 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
178 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
180 if (likely(!memory_is_poisoned(addr, size))) in check_region_inline()
183 return !kasan_report(addr, size, write, ret_ip); in check_region_inline()
186 bool kasan_check_range(const void *addr, size_t size, bool write, in kasan_check_range() argument
189 return check_region_inline(addr, size, write, ret_ip); in kasan_check_range()
217 size_t aligned_size = round_up(global->size, KASAN_GRANULE_SIZE); in register_global()
219 kasan_unpoison(global->beg, global->size, false); in register_global()
226 void __asan_register_globals(void *ptr, ssize_t size) in __asan_register_globals() argument
231 for (i = 0; i < size; i++) in __asan_register_globals()
236 void __asan_unregister_globals(void *ptr, ssize_t size) in __asan_unregister_globals() argument
241 #define DEFINE_ASAN_LOAD_STORE(size) \ argument
242 void __asan_load##size(void *addr) \
244 check_region_inline(addr, size, false, _RET_IP_); \
246 EXPORT_SYMBOL(__asan_load##size); \
247 __alias(__asan_load##size) \
248 void __asan_load##size##_noabort(void *); \
249 EXPORT_SYMBOL(__asan_load##size##_noabort); \
250 void __asan_store##size(void *addr) \
252 check_region_inline(addr, size, true, _RET_IP_); \
254 EXPORT_SYMBOL(__asan_store##size); \
255 __alias(__asan_store##size) \
256 void __asan_store##size##_noabort(void *); \
257 EXPORT_SYMBOL(__asan_store##size##_noabort)
265 void __asan_loadN(void *addr, ssize_t size) in __asan_loadN() argument
267 kasan_check_range(addr, size, false, _RET_IP_); in __asan_loadN()
275 void __asan_storeN(void *addr, ssize_t size) in __asan_storeN() argument
277 kasan_check_range(addr, size, true, _RET_IP_); in __asan_storeN()
290 void __asan_alloca_poison(void *addr, ssize_t size) in __asan_alloca_poison() argument
292 size_t rounded_up_size = round_up(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
293 size_t padding_size = round_up(size, KASAN_ALLOCA_REDZONE_SIZE) - in __asan_alloca_poison()
295 size_t rounded_down_size = round_down(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
304 size - rounded_down_size, false); in __asan_alloca_poison()
324 void __asan_set_shadow_##byte(const void *addr, ssize_t size) \
326 __memset((void *)addr, 0x##byte, size); \
353 void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, in kasan_cache_create() argument
373 ok_size = *size; in kasan_cache_create()
376 cache->kasan_info.alloc_meta_offset = *size; in kasan_cache_create()
377 *size += sizeof(struct kasan_alloc_meta); in kasan_cache_create()
380 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
382 *size = ok_size; in kasan_cache_create()
386 ok_size = *size; in kasan_cache_create()
398 cache->kasan_info.free_meta_offset = *size; in kasan_cache_create()
399 *size += sizeof(struct kasan_free_meta); in kasan_cache_create()
422 *size += rem_free_meta_size; in kasan_cache_create()
432 cache->kasan_info.free_meta_offset = *size; in kasan_cache_create()
433 *size += sizeof(struct kasan_free_meta); in kasan_cache_create()
437 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
440 *size = ok_size; in kasan_cache_create()
449 if (*size < optimal_size) in kasan_cache_create()
450 *size = optimal_size; in kasan_cache_create()