[xilinx-xlnx:xlnx_rebase_v5.15_LTS 270/1007] include/linux/fortify-string.h:187:4: error: call to __read_overflow2 declared with 'error' attribute: detected read beyond size of object passed as 2nd parameter

kernel test robot lkp at intel.com
Fri Mar 18 11:57:15 PDT 2022


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   452ffbe114c20f1d744fda914d163c0a21b78d1a
commit: 5e2af855147c7a9c5c9288a6888e298435a1c2c3 [270/1007] net: xilinx: Ethtool statistics support
config: x86_64-randconfig-a016 (https://download.01.org/0day-ci/archive/20220319/202203190216.ZojcN5CR-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a6e70e4056dff962ec634c5bd4f2f4105a0bef71)
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/Xilinx/linux-xlnx/commit/5e2af855147c7a9c5c9288a6888e298435a1c2c3
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout 5e2af855147c7a9c5c9288a6888e298435a1c2c3
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

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

Note: the xilinx-xlnx/xlnx_rebase_v5.15_LTS HEAD 452ffbe114c20f1d744fda914d163c0a21b78d1a builds fine.
      It only hurts bisectability.

All errors (new ones prefixed by >>):

   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2660:5: warning: no previous prototype for function 'axienet_ethtools_sset_count' [-Wmissing-prototypes]
   int axienet_ethtools_sset_count(struct net_device *ndev, int sset)
       ^
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2660:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int axienet_ethtools_sset_count(struct net_device *ndev, int sset)
   ^
   static 
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2683:6: warning: no previous prototype for function 'axienet_ethtools_get_stats' [-Wmissing-prototypes]
   void axienet_ethtools_get_stats(struct net_device *ndev,
        ^
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2683:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void axienet_ethtools_get_stats(struct net_device *ndev,
   ^
   static 
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2710:6: warning: no previous prototype for function 'axienet_ethtools_strings' [-Wmissing-prototypes]
   void axienet_ethtools_strings(struct net_device *ndev, u32 sset, u8 *data)
        ^
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2710:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void axienet_ethtools_strings(struct net_device *ndev, u32 sset, u8 *data)
   ^
   static 
   In file included from drivers/net/ethernet/xilinx/xilinx_axienet_main.c:25:
   In file included from include/linux/clk.h:14:
   In file included from include/linux/notifier.h:14:
   In file included from include/linux/mutex.h:17:
   In file included from include/linux/lockdep.h:14:
   In file included from include/linux/smp.h:13:
   In file included from include/linux/cpumask.h:12:
   In file included from include/linux/bitmap.h:10:
   In file included from include/linux/string.h:262:
>> include/linux/fortify-string.h:187:4: error: call to __read_overflow2 declared with 'error' attribute: detected read beyond size of object passed as 2nd parameter
                           __read_overflow2();
                           ^
   3 warnings and 1 error generated.


vim +/error +187 include/linux/fortify-string.h

a28a6e860c6cf2 Francis Laniel 2021-02-25  177  
a28a6e860c6cf2 Francis Laniel 2021-02-25  178  __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  179  {
a28a6e860c6cf2 Francis Laniel 2021-02-25  180  	size_t p_size = __builtin_object_size(p, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25  181  	size_t q_size = __builtin_object_size(q, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25  182  
a28a6e860c6cf2 Francis Laniel 2021-02-25  183  	if (__builtin_constant_p(size)) {
a28a6e860c6cf2 Francis Laniel 2021-02-25  184  		if (p_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  185  			__write_overflow();
a28a6e860c6cf2 Francis Laniel 2021-02-25  186  		if (q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 @187  			__read_overflow2();
a28a6e860c6cf2 Francis Laniel 2021-02-25  188  	}
a28a6e860c6cf2 Francis Laniel 2021-02-25  189  	if (p_size < size || q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  190  		fortify_panic(__func__);
a28a6e860c6cf2 Francis Laniel 2021-02-25  191  	return __underlying_memcpy(p, q, size);
a28a6e860c6cf2 Francis Laniel 2021-02-25  192  }
a28a6e860c6cf2 Francis Laniel 2021-02-25  193  

:::::: The code at line 187 was first introduced by commit
:::::: a28a6e860c6cf231cf3c5171c75c342adcd00406 string.h: move fortified functions definitions in a dedicated header.

:::::: TO: Francis Laniel <laniel_francis at privacyrequired.com>
:::::: CC: Linus Torvalds <torvalds at linux-foundation.org>

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



More information about the linux-arm-kernel mailing list