[linux-next:master 9528/10104] mm/kasan/report.c:272:44: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int')

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ea4dabbb4ad7eb52632a2ca0b8f89f0ea7c55dcf
commit: 088dec22162732a23b30e58191eeb443d5795fbe [9528/10104] kasan: infer allocation size by scanning metadata
config: powerpc-randconfig-r015-20230130 (https://download.01.org/0day-ci/archive/20230202/202302021325.700zGa0M-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=088dec22162732a23b30e58191eeb443d5795fbe
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 088dec22162732a23b30e58191eeb443d5795fbe
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash mm/kasan/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> mm/kasan/report.c:272:44: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                  rel_bytes, rel_type, region_state, info->alloc_size,
                                                     ^~~~~~~~~~~~~~~~
   include/linux/printk.h:500:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   include/linux/printk.h:457:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:429:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   mm/kasan/report.c:143:20: warning: unused function 'kasan_kunit_test_suite_executing' [-Wunused-function]
   static inline bool kasan_kunit_test_suite_executing(void) { return false; }
                      ^
   2 warnings generated.


vim +272 mm/kasan/report.c

   233	
   234	static void describe_object_addr(const void *addr, struct kasan_report_info *info)
   235	{
   236		unsigned long access_addr = (unsigned long)addr;
   237		unsigned long object_addr = (unsigned long)info->object;
   238		const char *rel_type, *region_state = "";
   239		int rel_bytes;
   240	
   241		pr_err("The buggy address belongs to the object at %px\n"
   242		       " which belongs to the cache %s of size %d\n",
   243			info->object, info->cache->name, info->cache->object_size);
   244	
   245		if (access_addr < object_addr) {
   246			rel_type = "to the left";
   247			rel_bytes = object_addr - access_addr;
   248		} else if (access_addr >= object_addr + info->alloc_size) {
   249			rel_type = "to the right";
   250			rel_bytes = access_addr - (object_addr + info->alloc_size);
   251		} else {
   252			rel_type = "inside";
   253			rel_bytes = access_addr - object_addr;
   254		}
   255	
   256		/*
   257		 * Tag-Based modes use the stack ring to infer the bug type, but the
   258		 * memory region state description is generated based on the metadata.
   259		 * Thus, defining the region state as below can contradict the metadata.
   260		 * Fixing this requires further improvements, so only infer the state
   261		 * for the Generic mode.
   262		 */
   263		if (IS_ENABLED(CONFIG_KASAN_GENERIC)) {
   264			if (strcmp(info->bug_type, "slab-out-of-bounds") == 0)
   265				region_state = "allocated ";
   266			else if (strcmp(info->bug_type, "slab-use-after-free") == 0)
   267				region_state = "freed ";
   268		}
   269	
   270		pr_err("The buggy address is located %d bytes %s of\n"
   271		       " %s%lu-byte region [%px, %px)\n",
 > 272		       rel_bytes, rel_type, region_state, info->alloc_size,
   273		       (void *)object_addr, (void *)(object_addr + info->alloc_size));
   274	}
   275	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux