oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [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: Thu, 2 Feb 2023 13:14:04 +0800	[thread overview]
Message-ID: <202302021325.700zGa0M-lkp@intel.com> (raw)

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@intel.com/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@intel.com>

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

                 reply	other threads:[~2023-02-02  5:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202302021325.700zGa0M-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Kuan-Ying.Lee@mediatek.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).