Re: [danielt-linux:kgdb/for-next 4/4] kernel/debug/debug_core.c:452:17: warning: array subscript is outside array bounds

From: Daniel Thompson
Date: Mon Oct 14 2019 - 12:28:53 EST


Hi Doug

On Fri, Oct 11, 2019 at 12:41:31AM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux.git kgdb/for-next
> head: 2277b492582d5525244519f60da6f9daea5ef41a
> commit: 2277b492582d5525244519f60da6f9daea5ef41a [4/4] kdb: Fix stack crawling on 'running' CPUs that aren't the master
> config: sh-allyesconfig (attached as .config)
> compiler: sh4-linux-gcc (GCC) 7.4.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 2277b492582d5525244519f60da6f9daea5ef41a
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=sh
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
>
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
>
> All warnings (new ones prefixed by >>):
>
> kernel/debug/debug_core.c: In function 'kdb_dump_stack_on_cpu':
> >> kernel/debug/debug_core.c:452:17: warning: array subscript is outside array bounds [-Warray-bounds]
> if (!(kgdb_info[cpu].exception_state & DCPU_IS_SLAVE)) {
> ~~~~~~~~~^~~~~
> kernel/debug/debug_core.c:469:33: warning: array subscript is outside array bounds [-Warray-bounds]
> kgdb_info[cpu].exception_state |= DCPU_WANT_BT;
> kernel/debug/debug_core.c:470:18: warning: array subscript is outside array bounds [-Warray-bounds]
> while (kgdb_info[cpu].exception_state & DCPU_WANT_BT)
> ~~~~~~~~~^~~~~

Thoughts on the following?