[gustavoars:testing/fam01-next20230815 2/4] arch/sparc/mm/init_64.c:3088:31: error: array subscript -1 is outside array bounds of 'char[]'

From: kernel test robot
Date: Tue Aug 15 2023 - 18:40:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/fam01-next20230815
head: 7d3ebbc1f4bfba0fdd9ade111e93edf6be617187
commit: 79dcfe2fd8c85fe5a9eeb8ed4026d50987d107b5 [2/4] Makefile: Enable -Warray-bounds
config: sparc64-randconfig-r001-20230816 (https://download.01.org/0day-ci/archive/20230816/202308160635.14367Mw4-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230816/202308160635.14367Mw4-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308160635.14367Mw4-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:2220:23: error: variable 'pagecv_flag' set but not used [-Werror=unused-but-set-variable]
2220 | unsigned long pagecv_flag;
| ^~~~~~~~~~~
arch/sparc/mm/init_64.c: At top level:
arch/sparc/mm/init_64.c:2644:6: error: no previous prototype for 'vmemmap_free' [-Werror=missing-prototypes]
2644 | void vmemmap_free(unsigned long start, unsigned long end,
| ^~~~~~~~~~~~
In function 'kernel_lds_init',
inlined from 'report_memory' at arch/sparc/mm/init_64.c:3100:2:
>> arch/sparc/mm/init_64.c:3088:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3088 | 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:3100:2:
arch/sparc/mm/init_64.c:3090:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3090 | 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:3100:2:
arch/sparc/mm/init_64.c:3092:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
3092 | 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 +3088 arch/sparc/mm/init_64.c

f6d4fb5cc0475c bob picco 2014-03-03 3084
f6d4fb5cc0475c bob picco 2014-03-03 3085 static void __init kernel_lds_init(void)
f6d4fb5cc0475c bob picco 2014-03-03 3086 {
f6d4fb5cc0475c bob picco 2014-03-03 3087 code_resource.start = compute_kern_paddr(_text);
f6d4fb5cc0475c bob picco 2014-03-03 @3088 code_resource.end = compute_kern_paddr(_etext - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3089 data_resource.start = compute_kern_paddr(_etext);
f6d4fb5cc0475c bob picco 2014-03-03 3090 data_resource.end = compute_kern_paddr(_edata - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3091 bss_resource.start = compute_kern_paddr(__bss_start);
f6d4fb5cc0475c bob picco 2014-03-03 3092 bss_resource.end = compute_kern_paddr(_end - 1);
f6d4fb5cc0475c bob picco 2014-03-03 3093 }
f6d4fb5cc0475c bob picco 2014-03-03 3094

:::::: The code at line 3088 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/wiki