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: <202108290711.X9FwdXcC-lkp@intel.com>
Date:   Sun, 29 Aug 2021 07:33:26 +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 94/113] 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:   44e41606b85b08fad5378c876547f8557f835cf6
commit: eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5 [94/113] x86/tdx: Make RDRAND/RDSEED loop forever
config: x86_64-randconfig-a001-20210829 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4e1a164d7bd53653f79decc121afe784d2fde0a7)
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/eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest
        git checkout eb26b8afd9b6c065a6cd81ca1fa48b3d6e11c5a5
        # 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:
   In file included from include/linux/protected_guest.h:39:
   In file included from arch/x86/include/asm/protected_guest.h:16:
   arch/x86/include/asm/tdx.h:188:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/bitmap.h:13: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" (37105 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ