Lines Matching refs:size
56 unsigned long size) in memory_is_poisoned_2_4_8() argument
64 if (unlikely(((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()
124 size_t size) in memory_is_poisoned_n() argument
129 kasan_mem_to_shadow((void *)addr + size - 1) + 1); in memory_is_poisoned_n()
132 unsigned long last_byte = addr + size - 1; in memory_is_poisoned_n()
142 static __always_inline bool memory_is_poisoned(unsigned long 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()
177 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(unsigned long 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()
212 size_t aligned_size = round_up(global->size, KASAN_GRANULE_SIZE); in register_global()
214 kasan_unpoison(global->beg, global->size, false); in register_global()
221 void __asan_register_globals(struct kasan_global *globals, size_t size) in __asan_register_globals() argument
225 for (i = 0; i < size; i++) in __asan_register_globals()
230 void __asan_unregister_globals(struct kasan_global *globals, size_t size) in __asan_unregister_globals() argument
235 #define DEFINE_ASAN_LOAD_STORE(size) \ argument
236 void __asan_load##size(unsigned long addr) \
238 check_region_inline(addr, size, false, _RET_IP_); \
240 EXPORT_SYMBOL(__asan_load##size); \
241 __alias(__asan_load##size) \
242 void __asan_load##size##_noabort(unsigned long); \
243 EXPORT_SYMBOL(__asan_load##size##_noabort); \
244 void __asan_store##size(unsigned long addr) \
246 check_region_inline(addr, size, true, _RET_IP_); \
248 EXPORT_SYMBOL(__asan_store##size); \
249 __alias(__asan_store##size) \
250 void __asan_store##size##_noabort(unsigned long); \
251 EXPORT_SYMBOL(__asan_store##size##_noabort)
259 void __asan_loadN(unsigned long addr, size_t size) in __asan_loadN() argument
261 kasan_check_range(addr, size, false, _RET_IP_); in __asan_loadN()
269 void __asan_storeN(unsigned long addr, size_t size) in __asan_storeN() argument
271 kasan_check_range(addr, size, true, _RET_IP_); in __asan_storeN()
284 void __asan_alloca_poison(unsigned long addr, size_t size) in __asan_alloca_poison() argument
286 size_t rounded_up_size = round_up(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
287 size_t padding_size = round_up(size, KASAN_ALLOCA_REDZONE_SIZE) - in __asan_alloca_poison()
289 size_t rounded_down_size = round_down(size, KASAN_GRANULE_SIZE); in __asan_alloca_poison()
298 size - rounded_down_size, false); in __asan_alloca_poison()
318 void __asan_set_shadow_##byte(const void *addr, size_t size) \
320 __memset((void *)addr, 0x##byte, size); \
355 void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, in kasan_cache_create() argument
375 ok_size = *size; in kasan_cache_create()
378 cache->kasan_info.alloc_meta_offset = *size; in kasan_cache_create()
379 *size += sizeof(struct kasan_alloc_meta); in kasan_cache_create()
387 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
389 *size = ok_size; in kasan_cache_create()
405 ok_size = *size; in kasan_cache_create()
407 cache->kasan_info.free_meta_offset = *size; in kasan_cache_create()
408 *size += sizeof(struct kasan_free_meta); in kasan_cache_create()
411 if (*size > KMALLOC_MAX_SIZE) { in kasan_cache_create()
413 *size = ok_size; in kasan_cache_create()
423 if (*size < optimal_size) in kasan_cache_create()
424 *size = optimal_size; in kasan_cache_create()