Re: [PATCH 1/4] RISC-V: create ISA string separately - not as part of cpuinfo

kernel test robot
2023-04-24T23:07:23Z

Hi Heiko,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20230424]
[also build test WARNING on v6.3]
[cannot apply to soc/for-next linus/master kees/for-next/execve v6.3 v6.3-rc7 v6.3-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Heiko-Stuebner/RISC-V-create-ISA-string-separately-not-as-part-of-cpuinfo/20230425-035214
base: next-20230424
patch link: https://lore.kernel.org/r/20230424194911.264850-2-heiko.stuebner%40vrull.eu
patch subject: [PATCH 1/4] RISC-V: create ISA string separately - not as part of cpuinfo
config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20230425/202304250614.g73yVtvv-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.1.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/8f1a5a16616d673f2c82cdc54ff845fd8b125a21
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Heiko-Stuebner/RISC-V-create-ISA-string-separately-not-as-part-of-cpuinfo/20230425-035214
git checkout 8f1a5a16616d673f2c82cdc54ff845fd8b125a21
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kernel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304250614.g73yVtvv-lkp@intel.com/

All warnings (new ones prefixed by >>):

In file included from include/linux/string.h:254,
from include/linux/bitmap.h:11,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/rcupdate.h:29,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from arch/riscv/kernel/cpu.c:6:
In function 'strnlen',
inlined from 'strncat' at include/linux/fortify-string.h:404:13,
inlined from 'riscv_create_isa_string' at arch/riscv/kernel/cpu.c:269:4:
>> include/linux/fortify-string.h:29:33: warning: 'strlen' argument missing terminating nul [-Wstringop-overread]
29 | __ret = __builtin_strlen(__p); \
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:195:24: note: in expansion of macro '__compiletime_strlen'
195 | size_t p_len = __compiletime_strlen(p);
| ^~~~~~~~~~~~~~~~~~~~
arch/riscv/kernel/cpu.c: In function 'riscv_create_isa_string':
arch/riscv/kernel/cpu.c:245:19: note: referenced argument declared here
245 | static const char base_riscv_exts[13] = "imafdqcbkjpvh";
| ^~~~~~~~~~~~~~~

vim +/strlen +29 include/linux/fortify-string.h

a28a6e860c6cf2 Francis Laniel 2021-02-25 18
3009f891bb9f32 Kees Cook 2021-08-02 19 #define __compiletime_strlen(p) \
3009f891bb9f32 Kees Cook 2021-08-02 20 ({ \
e9a40e1585d792 Kees Cook 2022-10-25 21 char *__p = (char *)(p); \
311fb40aa0569a Kees Cook 2022-09-02 22 size_t __ret = SIZE_MAX; \
9f7d69c5cd2390 Kees Cook 2022-09-19 23 size_t __p_size = __member_size(p); \
311fb40aa0569a Kees Cook 2022-09-02 24 if (__p_size != SIZE_MAX && \
d07c0acb4f41cc Kees Cook 2022-09-02 25 __builtin_constant_p(*__p)) { \
95cadae320be46 Qian Cai 2021-10-25 26 size_t __p_len = __p_size - 1; \
95cadae320be46 Qian Cai 2021-10-25 27 if (__builtin_constant_p(__p[__p_len]) && \
95cadae320be46 Qian Cai 2021-10-25 28 __p[__p_len] == '\0') \
95cadae320be46 Qian Cai 2021-10-25 @29 __ret = __builtin_strlen(__p); \
3009f891bb9f32 Kees Cook 2021-08-02 30 } \
95cadae320be46 Qian Cai 2021-10-25 31 __ret; \
3009f891bb9f32 Kees Cook 2021-08-02 32 })
3009f891bb9f32 Kees Cook 2021-08-02 33

--
0-DAY CI Kernel Test Service