[gustavoars:testing/fsfa3 17/22] arch/sparc/mm/init_64.c:3057:31: error: array subscript -1 is outside array bounds of 'char[]'
From: kernel test robot
Date: Tue Apr 11 2023 - 11:29:33 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/fsfa3
head: f33754bc67ff9f8377288f8795bf8ee536f6f16b
commit: 2226ddb6a576f7f89a8a06a3f89b68f5109ded53 [17/22] Makefile: Enable -Wstringop-overflow and -Warray-bounds
config: sparc64-buildonly-randconfig-r006-20230411 (https://download.01.org/0day-ci/archive/20230411/202304112345.Pn0e4esE-lkp@xxxxxxxxx/config)
compiler: sparc64-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://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=2226ddb6a576f7f89a8a06a3f89b68f5109ded53
git remote add gustavoars https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars testing/fsfa3
git checkout 2226ddb6a576f7f89a8a06a3f89b68f5109ded53
# 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=sparc64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc64 SHELL=/bin/bash arch/sparc/mm/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304112345.Pn0e4esE-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
arch/sparc/mm/init_64.c: In function 'sun4v_linear_pte_xor_finalize':
arch/sparc/mm/init_64.c:2206:23: error: variable 'pagecv_flag' set but not used [-Werror=unused-but-set-variable]
2206 | unsigned long pagecv_flag;
| ^~~~~~~~~~~
In function 'kernel_lds_init',
inlined from 'report_memory' at arch/sparc/mm/init_64.c:3069:2:
>> arch/sparc/mm/init_64.c:3057:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3057 | code_resource.end = compute_kern_paddr(_etext - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/sparc/include/asm/sections.h:6,
from include/linux/interrupt.h:21,
from include/linux/kernel_stat.h:9,
from include/linux/cgroup.h:26,
from include/linux/hugetlb.h:10,
from arch/sparc/mm/init_64.c:16:
include/asm-generic/sections.h: In function 'report_memory':
include/asm-generic/sections.h:35:32: note: at offset -1 into object '_etext' of size [0, 9223372036854775807]
35 | extern char _text[], _stext[], _etext[];
| ^~~~~~
In function 'kernel_lds_init',
inlined from 'report_memory' at arch/sparc/mm/init_64.c:3069:2:
arch/sparc/mm/init_64.c:3059:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3059 | data_resource.end = compute_kern_paddr(_edata - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/sections.h: In function 'report_memory':
include/asm-generic/sections.h:36:32: note: at offset -1 into object '_edata' of size [0, 9223372036854775807]
36 | extern char _data[], _sdata[], _edata[];
| ^~~~~~
In function 'kernel_lds_init',
inlined from 'report_memory' at arch/sparc/mm/init_64.c:3069:2:
arch/sparc/mm/init_64.c:3061:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3061 | bss_resource.end = compute_kern_paddr(_end - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/sections.h: In function 'report_memory':
include/asm-generic/sections.h:41:13: note: at offset -1 into object '_end' of size [0, 9223372036854775807]
41 | extern char _end[];
| ^~~~
cc1: all warnings being treated as errors
vim +3057 arch/sparc/mm/init_64.c
f6d4fb5cc0475c bob picco 2014-03-03 3053
f6d4fb5cc0475c bob picco 2014-03-03 3054 static void __init kernel_lds_init(void)
f6d4fb5cc0475c bob picco 2014-03-03 3055 {
f6d4fb5cc0475c bob picco 2014-03-03 3056 code_resource.start = compute_kern_paddr(_text);
f6d4fb5cc0475c bob picco 2014-03-03 @3057 code_resource.end = compute_kern_paddr(_etext - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3058 data_resource.start = compute_kern_paddr(_etext);
f6d4fb5cc0475c bob picco 2014-03-03 3059 data_resource.end = compute_kern_paddr(_edata - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3060 bss_resource.start = compute_kern_paddr(__bss_start);
f6d4fb5cc0475c bob picco 2014-03-03 3061 bss_resource.end = compute_kern_paddr(_end - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3062 }
f6d4fb5cc0475c bob picco 2014-03-03 3063
:::::: The code at line 3057 was first introduced by commit
:::::: f6d4fb5cc0475c36437a618db31cbb7f2bf7c282 sparc64 - add mem to iomem resource
:::::: TO: bob picco <bpicco@xxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests