Hi Kuan-Ying, Thank you for the patch! Yet something to improve: [auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on linus/master v6.2-rc2 next-20230105] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kuan-Ying-Lee/kasan-infer-the-requested-size-by-scanning-shadow-memory/20230103-155641 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20230103075603.12294-1-Kuan-Ying.Lee%40mediatek.com patch subject: [PATCH] kasan: infer the requested size by scanning shadow memory config: arm64-randconfig-c004-20230105 compiler: aarch64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/2e7537415684a55e473e98515beeef6d03e09c8f git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Kuan-Ying-Lee/kasan-infer-the-requested-size-by-scanning-shadow-memory/20230103-155641 git checkout 2e7537415684a55e473e98515beeef6d03e09c8f # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash mm/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from mm/kasan/common.c:30: mm/kasan/kasan.h: In function 'kasan_get_alloc_size': >> mm/kasan/kasan.h:348:21: error: invalid use of undefined type 'struct kmem_cache' 348 | return cache->object_size; | ^~ -- In file included from mm/kasan/report.c:34: mm/kasan/kasan.h: In function 'kasan_get_alloc_size': >> mm/kasan/kasan.h:348:21: error: invalid use of undefined type 'struct kmem_cache' 348 | return cache->object_size; | ^~ mm/kasan/kasan.h:349:1: error: control reaches end of non-void function [-Werror=return-type] 349 | } | ^ cc1: some warnings being treated as errors -- In file included from mm/kasan/sw_tags.c:33: mm/kasan/kasan.h: In function 'kasan_get_alloc_size': >> mm/kasan/kasan.h:348:21: error: invalid use of undefined type 'struct kmem_cache' 348 | return cache->object_size; | ^~ mm/kasan/sw_tags.c: At top level: mm/kasan/sw_tags.c:173:6: warning: no previous prototype for 'kasan_tag_mismatch' [-Wmissing-prototypes] 173 | void kasan_tag_mismatch(unsigned long addr, unsigned long access_info, | ^~~~~~~~~~~~~~~~~~ vim +348 mm/kasan/kasan.h 340 341 #ifdef CONFIG_KASAN_GENERIC 342 void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object); 343 int kasan_get_alloc_size(void *object_addr, struct kmem_cache *cache); 344 #else 345 static inline void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object) { } 346 static inline int kasan_get_alloc_size(void *object_addr, struct kmem_cache *cache) 347 { > 348 return cache->object_size; 349 } 350 #endif 351 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests