tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: a2b4d661a5ca59dd7cf972c1cce8b98422102ab7 commit: d5ddd7080c7442f22d6b92d6fed0dacc606013d1 [2441/2441] kasan: sanitize objects when metadata doesn't fit config: arm64-randconfig-003-20241118 (https://download.01.org/0day-ci/archive/20241201/202412011647.JJxaTRfd-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241201/202412011647.JJxaTRfd-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202412011647.JJxaTRfd-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/kasan/common.c:40: mm/kasan/kasan.h: In function 'quarantine_put': mm/kasan/kasan.h:198:84: warning: 'return' with a value, in function returning void [-Wreturn-mismatch] 198 | static inline void quarantine_put(struct kmem_cache *cache, void *object) { return false; } | ^~~~~ mm/kasan/kasan.h:198:20: note: declared here 198 | static inline void quarantine_put(struct kmem_cache *cache, void *object) { return false; } | ^~~~~~~~~~~~~~ mm/kasan/common.c: In function '__kasan_slab_free':
mm/kasan/common.c:471:16: error: void value not ignored as it ought to be
471 | return quarantine_put(cache, object); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/kasan/common.c:472:1: warning: control reaches end of non-void function [-Wreturn-type] 472 | } | ^
vim +471 mm/kasan/common.c
431 432 static bool __kasan_slab_free(struct kmem_cache *cache, void *object, 433 unsigned long ip, bool quarantine) 434 { 435 s8 shadow_byte; 436 u8 tag; 437 void *tagged_object; 438 unsigned long rounded_up_size; 439 440 tag = get_tag(object); 441 tagged_object = object; 442 object = reset_tag(object); 443 444 if (is_kfence_address(object)) 445 return false; 446 447 if (unlikely(nearest_obj(cache, virt_to_head_page(object), object) != 448 object)) { 449 kasan_report_invalid_free(tagged_object, ip); 450 return true; 451 } 452 453 /* RCU slabs could be legally used after free within the RCU period */ 454 if (unlikely(cache->flags & SLAB_TYPESAFE_BY_RCU)) 455 return false; 456 457 shadow_byte = READ_ONCE(*(s8 *)kasan_mem_to_shadow(object)); 458 if (shadow_invalid(tag, shadow_byte)) { 459 kasan_report_invalid_free(tagged_object, ip); 460 return true; 461 } 462 463 rounded_up_size = round_up(cache->object_size, KASAN_SHADOW_SCALE_SIZE); 464 kasan_poison_shadow(object, rounded_up_size, KASAN_KMALLOC_FREE); 465 466 if ((IS_ENABLED(CONFIG_KASAN_GENERIC) && !quarantine)) 467 return false; 468 469 kasan_set_free_info(cache, object, tag); 470
471 return quarantine_put(cache, object);
472 } 473