Subject: Re: [PATCH net-next v2 1/3] devlink: introduce framework for selftests

From: kernel test robot <[email-masked]>
Date: Fri, 8 Jul 2022 16:04:41 +0800

Hi Vikas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Vikas-Gupta/devlink-introduce-framework-for-selftests/20220708-033020
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git cf21b355ccb39b0de0b6a7362532bb5584c84a80
config: arm64-allyesconfig
compiler: aarch64-linux-gcc (GCC) 11.3.0
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-lab-lkp/linux/commit/5c0b96e4473bc2ce567607d43fa8c8f27db92c17
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vikas-Gupta/devlink-introduce-framework-for-selftests/20220708-033020
        git checkout 5c0b96e4473bc2ce567607d43fa8c8f27db92c17
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   In file included from include/linux/string.h:253,
                    from include/linux/bitmap.h:11,
                    from include/linux/cpumask.h:12,
                    from include/linux/smp.h:13,
                    from arch/arm64/include/asm/arch_timer.h:18,
                    from arch/arm64/include/asm/timex.h:8,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/skbuff.h:15,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from net/core/devlink.c:10:
   net/core/devlink.c: In function 'devlink_nl_cmd_selftests_show':
>> include/linux/fortify-string.h:24:45: warning: array subscript 7 is outside array bounds of 'char[6]' [-Warray-bounds]
      24 |                 if (__builtin_constant_p(__p[__p_len]) &&       \
         |                                          ~~~^~~~~~~~~
   include/linux/fortify-string.h:108:24: note: in expansion of macro '__compiletime_strlen'
     108 |         size_t p_len = __compiletime_strlen(p);
         |                        ^~~~~~~~~~~~~~~~~~~~
   net/core/devlink.c: In function 'devlink_nl_cmd_selftests_run':
>> include/linux/fortify-string.h:24:45: warning: array subscript 7 is outside array bounds of 'char[6]' [-Warray-bounds]
      24 |                 if (__builtin_constant_p(__p[__p_len]) &&       \
         |                                          ~~~^~~~~~~~~
   include/linux/fortify-string.h:108:24: note: in expansion of macro '__compiletime_strlen'
     108 |         size_t p_len = __compiletime_strlen(p);
         |                        ^~~~~~~~~~~~~~~~~~~~

vim +24 include/linux/fortify-string.h

a28a6e860c6cf23 Francis Laniel 2021-02-25  16  
3009f891bb9f328 Kees Cook      2021-08-02  17  #define __compiletime_strlen(p)					\
3009f891bb9f328 Kees Cook      2021-08-02  18  ({								\
3009f891bb9f328 Kees Cook      2021-08-02  19  	unsigned char *__p = (unsigned char *)(p);		\
95cadae320be465 Qian Cai       2021-10-25  20  	size_t __ret = (size_t)-1;				\
95cadae320be465 Qian Cai       2021-10-25  21  	size_t __p_size = __builtin_object_size(p, 1);		\
95cadae320be465 Qian Cai       2021-10-25  22  	if (__p_size != (size_t)-1) {				\
95cadae320be465 Qian Cai       2021-10-25  23  		size_t __p_len = __p_size - 1;			\
95cadae320be465 Qian Cai       2021-10-25 @24  		if (__builtin_constant_p(__p[__p_len]) &&	\
95cadae320be465 Qian Cai       2021-10-25  25  		    __p[__p_len] == '\0')			\
95cadae320be465 Qian Cai       2021-10-25  26  			__ret = __builtin_strlen(__p);		\
3009f891bb9f328 Kees Cook      2021-08-02  27  	}							\
95cadae320be465 Qian Cai       2021-10-25  28  	__ret;							\
3009f891bb9f328 Kees Cook      2021-08-02  29  })
3009f891bb9f328 Kees Cook      2021-08-02  30  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp