[linux-next:master 3401/4499] lib/test_scanf.c:247:9: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)

[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:   8dca2cd055ffb78b37f52f0bf0bd20c249619c4d
commit: 50f530e176eac808e64416732e54c0686ce2c39b [3401/4499] lib: test_scanf: Add tests for sscanf number conversion
config: m68k-randconfig-s031-20210522 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=50f530e176eac808e64416732e54c0686ce2c39b
        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 50f530e176eac808e64416732e54c0686ce2c39b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)
>> lib/test_scanf.c:247:9: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   lib/test_scanf.c:250:9: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   lib/test_scanf.c:253:9: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
>> lib/test_scanf.c:256:9: sparse: sparse: cast truncates bits from constant value (ffffff01 becomes 1)
   lib/test_scanf.c:259:9: sparse: sparse: cast truncates bits from constant value (ffffff01 becomes 1)
   lib/test_scanf.c:262:9: sparse: sparse: cast truncates bits from constant value (ffffff01 becomes 1)
   lib/test_scanf.c: note: in included file (through include/linux/random.h):
   include/linux/prandom.h:114:45: sparse: sparse: cast truncates bits from constant value (4f2e5357408c3c09 becomes 408c3c09)

vim +247 lib/test_scanf.c

   217	
   218	static void __init numbers_simple(void)
   219	{
   220		simple_numbers_loop(unsigned long long,	"%llu",	  "llu", check_ull);
   221		simple_numbers_loop(long long,		"%lld",	  "lld", check_ll);
   222		simple_numbers_loop(long long,		"%lld",	  "lli", check_ll);
   223		simple_numbers_loop(unsigned long long,	"%llx",	  "llx", check_ull);
   224		simple_numbers_loop(long long,		"%llx",	  "llx", check_ll);
   225		simple_numbers_loop(long long,		"0x%llx", "lli", check_ll);
   226		simple_numbers_loop(unsigned long long, "0x%llx", "llx", check_ull);
   227		simple_numbers_loop(long long,		"0x%llx", "llx", check_ll);
   228	
   229		simple_numbers_loop(unsigned long,	"%lu",	  "lu", check_ulong);
   230		simple_numbers_loop(long,		"%ld",	  "ld", check_long);
   231		simple_numbers_loop(long,		"%ld",	  "li", check_long);
   232		simple_numbers_loop(unsigned long,	"%lx",	  "lx", check_ulong);
   233		simple_numbers_loop(long,		"%lx",	  "lx", check_long);
   234		simple_numbers_loop(long,		"0x%lx",  "li", check_long);
   235		simple_numbers_loop(unsigned long,	"0x%lx",  "lx", check_ulong);
   236		simple_numbers_loop(long,		"0x%lx",  "lx", check_long);
   237	
   238		simple_numbers_loop(unsigned int,	"%u",	  "u", check_uint);
   239		simple_numbers_loop(int,		"%d",	  "d", check_int);
   240		simple_numbers_loop(int,		"%d",	  "i", check_int);
   241		simple_numbers_loop(unsigned int,	"%x",	  "x", check_uint);
   242		simple_numbers_loop(int,		"%x",	  "x", check_int);
   243		simple_numbers_loop(int,		"0x%x",   "i", check_int);
   244		simple_numbers_loop(unsigned int,	"0x%x",   "x", check_uint);
   245		simple_numbers_loop(int,		"0x%x",   "x", check_int);
   246	
 > 247		simple_numbers_loop(unsigned short,	"%hu",	  "hu", check_ushort);
   248		simple_numbers_loop(short,		"%hd",	  "hd", check_short);
   249		simple_numbers_loop(short,		"%hd",	  "hi", check_short);
   250		simple_numbers_loop(unsigned short,	"%hx",	  "hx", check_ushort);
   251		simple_numbers_loop(short,		"%hx",	  "hx", check_short);
   252		simple_numbers_loop(short,		"0x%hx",  "hi", check_short);
   253		simple_numbers_loop(unsigned short,	"0x%hx",  "hx", check_ushort);
   254		simple_numbers_loop(short,		"0x%hx",  "hx", check_short);
   255	
 > 256		simple_numbers_loop(unsigned char,	"%hhu",	  "hhu", check_uchar);
   257		simple_numbers_loop(signed char,	"%hhd",	  "hhd", check_char);
   258		simple_numbers_loop(signed char,	"%hhd",	  "hhi", check_char);
   259		simple_numbers_loop(unsigned char,	"%hhx",	  "hhx", check_uchar);
   260		simple_numbers_loop(signed char,	"%hhx",	  "hhx", check_char);
   261		simple_numbers_loop(signed char,	"0x%hhx", "hhi", check_char);
   262		simple_numbers_loop(unsigned char,	"0x%hhx", "hhx", check_uchar);
   263		simple_numbers_loop(signed char,	"0x%hhx", "hhx", check_char);
   264	}
   265	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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