Skip to content

Commit d07ce4e

Browse files
author
Daniel Thompson
committed
kdb: Avoid array subscript warnings on non-SMP builds
Recent versions of gcc (reported on gcc-7.4) issue array subscript warnings for builds where SMP is not enabled. 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) There is no bug here but there is scope to improve the code generation for non-SMP systems (whilst also silencing the warning). Reported-by: kbuild test robot <[email protected]> Fixes: 2277b49 ("kdb: Fix stack crawling on 'running' CPUs that aren't the master") Signed-off-by: Daniel Thompson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Douglas Anderson <[email protected]>
1 parent 2277b49 commit d07ce4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/debug/debug_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ int dbg_remove_all_break(void)
444444
#ifdef CONFIG_KGDB_KDB
445445
void kdb_dump_stack_on_cpu(int cpu)
446446
{
447-
if (cpu == raw_smp_processor_id()) {
447+
if (cpu == raw_smp_processor_id() || !IS_ENABLED(CONFIG_SMP)) {
448448
dump_stack();
449449
return;
450450
}

0 commit comments

Comments
 (0)