lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108311644.qwFTp0L5-lkp@intel.com>
Date:   Tue, 31 Aug 2021 16:18:08 +0800
From:   kernel test robot <lkp@...el.com>
To:     Andi Kleen <ak@...ux.intel.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Subject: [intel-tdx:guest 98/127] net/ipv4/fib_trie.c:324:13: warning:
 implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int')
 changes value from 2305843009213693946 to 4294967290

tree:   https://github.com/intel/tdx.git guest
head:   60fe4cbb60bc7f59aa2b9c5885c42b7a06b53a79
commit: 96d988b9f378bfacd90dd73b4bc9cc1b8f91febc [98/127] x86/tdx: Make RDRAND/RDSEED loop forever
config: x86_64-randconfig-r024-20210831 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
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/tdx/commit/96d988b9f378bfacd90dd73b4bc9cc1b8f91febc
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest
        git checkout 96d988b9f378bfacd90dd73b4bc9cc1b8f91febc
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

   In file included from net/ipv4/fib_trie.c:49:
   In file included from include/linux/inet.h:42:
   In file included from include/net/net_namespace.h:39:
   In file included from include/linux/skbuff.h:26:
   In file included from include/linux/net.h:18:
   In file included from include/linux/random.h:121:
   In file included from arch/x86/include/asm/archrandom.h:13:
   include/linux/protected_guest.h:57:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> net/ipv4/fib_trie.c:324:13: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 2305843009213693946 to 4294967290 [-Wconstant-conversion]
           if (bits > TNODE_VMALLOC_MAX)
                      ^~~~~~~~~~~~~~~~~
   net/ipv4/fib_trie.c:305:35: note: expanded from macro 'TNODE_VMALLOC_MAX'
           ilog2((SIZE_MAX - TNODE_SIZE(0)) / sizeof(struct key_vector *))
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/log2.h:162:14: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ~~~~~~~~~~~ ^
   1 warning and 1 error generated.


vim +324 net/ipv4/fib_trie.c

37fd30f2da573c Alexander Duyck   2014-12-31  318  
dc35dbeda3e00a Alexander Duyck   2015-03-06  319  static struct tnode *tnode_alloc(int bits)
f0e36f8cee8101 Patrick McHardy   2005-07-05  320  {
1de3d87bcd2c2e Alexander Duyck   2015-03-04  321  	size_t size;
1de3d87bcd2c2e Alexander Duyck   2015-03-04  322  
1de3d87bcd2c2e Alexander Duyck   2015-03-04  323  	/* verify bits is within bounds */
1de3d87bcd2c2e Alexander Duyck   2015-03-04 @324  	if (bits > TNODE_VMALLOC_MAX)
1de3d87bcd2c2e Alexander Duyck   2015-03-04  325  		return NULL;
1de3d87bcd2c2e Alexander Duyck   2015-03-04  326  
1de3d87bcd2c2e Alexander Duyck   2015-03-04  327  	/* determine size and verify it is non-zero and didn't overflow */
1de3d87bcd2c2e Alexander Duyck   2015-03-04  328  	size = TNODE_SIZE(1ul << bits);
1de3d87bcd2c2e Alexander Duyck   2015-03-04  329  
2373ce1ca04dd4 Robert Olsson     2005-08-25  330  	if (size <= PAGE_SIZE)
8d96544475b236 Eric Dumazet      2008-01-13  331  		return kzalloc(size, GFP_KERNEL);
15be75cdb5db44 Stephen Hemminger 2008-04-10  332  	else
7a1c8e5ab120a5 Eric Dumazet      2010-11-20  333  		return vzalloc(size);
15be75cdb5db44 Stephen Hemminger 2008-04-10  334  }
2373ce1ca04dd4 Robert Olsson     2005-08-25  335  

:::::: The code at line 324 was first introduced by commit
:::::: 1de3d87bcd2c2e631500b9e4f0c40b38ce0d0d57 fib_trie: Prevent allocating tnode if bits is too big for size_t

:::::: TO: Alexander Duyck <alexander.h.duyck@...hat.com>
:::::: CC: David S. Miller <davem@...emloft.net>

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

Download attachment ".config.gz" of type "application/gzip" (30669 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ