aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/debug
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2019-10-21 11:10:56 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2019-10-24 15:34:58 +0100
commitd07ce4e32a8d68062c58a3e635619313c52d0bf7 (patch)
tree1f3751b10d9407731df92af9cceb571772f6b1e7 /kernel/debug
parentkdb: Fix stack crawling on 'running' CPUs that aren't the master (diff)
downloadlinux-dev-d07ce4e32a8d68062c58a3e635619313c52d0bf7.tar.xz
linux-dev-d07ce4e32a8d68062c58a3e635619313c52d0bf7.zip
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 <lkp@intel.com> Fixes: 2277b492582d ("kdb: Fix stack crawling on 'running' CPUs that aren't the master") Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20191021101057.23861-1-daniel.thompson@linaro.org Reviewed-by: Douglas Anderson <dianders@chromium.org>
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/debug_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 70e86b4b4932..2b7c9b67931d 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -444,7 +444,7 @@ setundefined:
#ifdef CONFIG_KGDB_KDB
void kdb_dump_stack_on_cpu(int cpu)
{
- if (cpu == raw_smp_processor_id()) {
+ if (cpu == raw_smp_processor_id() || !IS_ENABLED(CONFIG_SMP)) {
dump_stack();
return;
}