Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4062390ybg; Mon, 21 Oct 2019 03:12:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdW58bUgqpUaPYwGvuH3LCRMyT9WDYlafbIBAzgsuKmaCHz0otWFNoRVUHUUb9t+ueS8oN X-Received: by 2002:a17:906:f75a:: with SMTP id jp26mr21134836ejb.191.1571652728884; Mon, 21 Oct 2019 03:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571652728; cv=none; d=google.com; s=arc-20160816; b=T7qw+H0mDMNafPTiRxqm9gCBPxA1j4vMc3Ur8/msngGs+6UiA3nUXKbzFqATm34E0q 1x+g4w4rP3t9oZkWJvnGv3xKRoxq7HNRlSVtPGQTMg4b8b3aT8ERzvjXdGwcMa984qCO KdGJNvm5pjP9DGimpJwuCdKCTDY45Qe5FGBFOdLRFABWa9bv67dzIA8qzI62hz1VXovk ZiZLGPnGFcw8acFrw0ffMkjMwRCOBreXxkMiF6xvcNmLjAojez5RW4EM4X2Ztt/MPsd5 m6pHTcZ/6A50Vt3EMGMjEauVP/6OBaewHCvF+B5fp/i0OdENakBXTBDGggbIMvrEn0B+ JPoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ejY+9Vm9aWJOs97zrA807+W9n/23O9nYbfu1WQqsyN4=; b=vlMUl7k+17iQCXZHJkGSzVn6HXrLNQKd1tk+/c/5jgLLgpUg5pEdfbiUQvRNdERz/H xeStqDRshmjyxxZJgA1uZXSI86zcQ6a98N/tByHkecTW+HXI+8NFDRJgo26goBkgWQdE mK7iSNJ4sWqaN0HjphsWQ4/njUpMii/Y0wbMODxOb2J8XnG4/r7VWO2zTr1Re381K3XT WKiL+pfbvfxsfbFEvMov00UWO6hD2Qay4jpcb8xjCHg/cUdMIu+4YcipZFPY4KqK9J/j PlTU3RxlvmrTdQ/IQ2c4MDJXZ6oCRzXQOdhNFqH40rb/AtXAJQHWVS4Y231OHaDZnSR5 Qs6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z67VptU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si2297255eju.426.2019.10.21.03.11.44; Mon, 21 Oct 2019 03:12:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z67VptU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbfJUKLK (ORCPT + 99 others); Mon, 21 Oct 2019 06:11:10 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33119 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfJUKLJ (ORCPT ); Mon, 21 Oct 2019 06:11:09 -0400 Received: by mail-wm1-f65.google.com with SMTP id 6so1001672wmf.0 for ; Mon, 21 Oct 2019 03:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ejY+9Vm9aWJOs97zrA807+W9n/23O9nYbfu1WQqsyN4=; b=Z67VptU0dpTYTmG3ohv8pDSd0+CsFi7qspyxYHYbGvD4wdiRDK3vqJVHPZPaqGXGOm uiLYWy/FZwE/YhpSsGe+Sl426PcGkC6fMRTzwDAHXswSlrMcjOkTambq8295/tCALvGN rKKL5+SWYo8AmXf6bCtgIPSZ2htVNwBaq/RYG1N2EpqnkLXR1qUvuOSfxPAs8j7Wf7kD 3ll16iGmFYL4xgfA8RE0S8f7n+faLm8GMFfaXf3OxL6zXNAX5JcGExaSdX2c1FHiTUTH qMKjwTektqUZvXtXiNWR0tqZbofdwnfpfpP7aVIwRxsGnEe4DScDdboA2uBjKM8tZt8Q 6KiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ejY+9Vm9aWJOs97zrA807+W9n/23O9nYbfu1WQqsyN4=; b=LVF3ne7Z2uLcjyBJ8EZhConz2C0XeeAC2FNFF5ewGLoT9ZTygyZ7Vnzmi9XXrTpRx/ Xq7u9/31Qp+lR0j3FLWCge0OVqqGJWJ5Gk4vEHGzKXm4qSDOh02af9grn5Ef2b1uXqNY i5w0z3AYXhFTfDqL++8tPTHujX5c7ySALi8SA4yBCYdUvU3ctMADIqZ7Bt+du6f4j/cP Ytvrh4vqwME8w8kEH/db5tbG6zT9O6Uv+zBn9VtS0hpBqRoLl3d5WsMNHSWqs4EI92E7 UbK7FwWlhtmniOF3BvdPcXsPSJ1SMw7E5u/yTZnQJjvggTpWEdoCH/do+p6kTX01+y6G 4oTw== X-Gm-Message-State: APjAAAVuatymDRTq897GwNUtR5bImt2Ed9ph+t0rVTqRNwHDeNWmfq3U uBQCCZJFr8m6DokIc+itcXjPEQ== X-Received: by 2002:a1c:2884:: with SMTP id o126mr20068584wmo.153.1571652667359; Mon, 21 Oct 2019 03:11:07 -0700 (PDT) Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id j63sm15978535wmj.46.2019.10.21.03.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 03:11:06 -0700 (PDT) From: Daniel Thompson To: Douglas Anderson , Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org, kbuild test robot Subject: [PATCH v2] kdb: Avoid array subscript warnings on non-SMP builds Date: Mon, 21 Oct 2019 11:10:56 +0100 Message-Id: <20191021101057.23861-1-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Fixes: 2277b492582d ("kdb: Fix stack crawling on 'running' CPUs that aren't the master") Signed-off-by: Daniel Thompson --- Notes: Changes in v2: - Moved the IS_ENABLED(CONFIG_SMP) test to the first (slightly easier to read the code, improves code generation a little) - Sent out as a proper patch e-mail ;-) kernel/debug/debug_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ int dbg_remove_all_break(void) #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; } -- 2.21.0