From patchwork Tue Mar 19 15:52:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 160580 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4040073jad; Tue, 19 Mar 2019 08:53:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFcFZIy9wgUx8wr42wNJW7QHpAy8tTbGy+XVqaNoxghZ0vH2dHEhhxNZMcJy2FnUlYrfwz X-Received: by 2002:a63:5259:: with SMTP id s25mr6198440pgl.230.1553010838190; Tue, 19 Mar 2019 08:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553010838; cv=none; d=google.com; s=arc-20160816; b=lHlSHn6e/Kvbah0UTNEaJZjdhSS8ssClgWmlJapR7xuvrRZrfU+KJmP7D2q4zbZItD sgwdabjOY0nNfD/0/WUd6h6omNeaIgJ4rJJtKu+dYap230nUqnV8gX3jJc6ihbDGFlOL 9U8Ct75Q+4+aNa4ow8ZTTARf5DvmquMIyNPQ/YHIifpMwq5lm2OXDnj5xHYCYv20LSmV jv3kw5JQmB7pSqWlw76JR54baGdvZGiNW3zLNAWZ4dPhcqeF5domGGj3lPFvsq5FAJWx afxvcGoD4GbhSCxHNUrUfQmaigJIHSJU1Po788HxebLf9lou7urHc0G8QS/76iqo4leN A4tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=A2+cO3hRpKwBj1MVA+O6aHySKEo9Y616LGE3nKQruds=; b=VWNck6smqDJuatLNgK2z0QujyJZ7XA2RriCEWuAJEfgt/LOAdN/WTlT+tIVae9KIJo KkFOEnaYASF+mFcTWOupa9j44H2ZVXGCJapUSaZ+fZF5crHHR/ie4GNGjRTgmzyVOzWo ruY2XiHqJLGHNDc9pECnAUUPUPDmUsZfJihwhjQpahUjZ7uzxTg1rWmOQFtP4f055qoK 8t95aqpWQckeJ2/h7PE0Q/fVCaLYf1HcpBHUEIEYHGo5Pc3KjspqrLNO8Z/cnQfDPMV8 C7akTKjnQ4yeOHOtY/V8tesoORitFjRCslsLzu9Cct1/8rAm4eaK2YXELtkvs4elfyDi kpTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=be1CiYfJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si11280525pgv.39.2019.03.19.08.53.57; Tue, 19 Mar 2019 08:53:58 -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=@nifty.com header.s=dec2015msa header.b=be1CiYfJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727371AbfCSPx4 (ORCPT + 31 others); Tue, 19 Mar 2019 11:53:56 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:63825 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726579AbfCSPx4 (ORCPT ); Tue, 19 Mar 2019 11:53:56 -0400 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id x2JFqgQx020669; Wed, 20 Mar 2019 00:52:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x2JFqgQx020669 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1553010763; bh=A2+cO3hRpKwBj1MVA+O6aHySKEo9Y616LGE3nKQruds=; h=From:To:Cc:Subject:Date:From; b=be1CiYfJOkj8Tohd/jh1ApcDdoJIfcJ6QVf7S8jPrKkG0dSjCkYXynbioJcKpIbBi OiWyXYK48s/RAKrnsmg1dxxbW8uzKm4aYwJOEu5hGbrx3mcBoDHIE7pKQF5Uo9WCFq vyGTLFvImudNOAd7BcGLIBlGixIy6uAgL6rY2M1MbHhTBUI3KZThV525aHMUjnEMhb TyMfr0vD7h/zhN6njygXs+DYqmIQxpBNgarjADUMrvXwNdSg2UupOiPn+nExmraxZx VxgwSldlC33ZmWOGgfDkjE0CxAp6cu7r1SqHk588RYQ0xxE2nNeFNJfj1zdeXh7Csg 6fdEKlbVzR5zQ== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org Cc: Marc Zyngier , Russell King , Masahiro Yamada , Grygorii Strashko , linux-kernel@vger.kernel.org, Yufen Wang , Russell King , Dietmar Eggemann Subject: [PATCH] ARM: fix out-of-bound access to ipi_types[] Date: Wed, 20 Mar 2019 00:52:25 +0900 Message-Id: <1553010745-26585-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI"), IPI_CPU_BACKTRACE is assigned to SGI7. raise_nmi() passes IPI_CPU_BACKTRACE (=7) into smp_cross_call(), but it is above the array bound of ipi_types[]. Increase NR_IPI, and add the entry to ipi_types[]. This fixes the following GCC warning: CC arch/arm/kernel/smp.o arch/arm/kernel/smp.c: In function 'raise_nmi': arch/arm/kernel/smp.c:522:2: warning: array subscript 7 is above array bounds of 'const char *[7]' [-Warray-bounds] trace_ipi_raise_rcuidle(target, ipi_types[ipinr]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Masahiro Yamada --- arch/arm/include/asm/hardirq.h | 2 +- arch/arm/kernel/smp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h index cba23ea..c7e3a71 100644 --- a/arch/arm/include/asm/hardirq.h +++ b/arch/arm/include/asm/hardirq.h @@ -6,7 +6,7 @@ #include #include -#define NR_IPI 7 +#define NR_IPI 8 typedef struct { unsigned int __softirq_pending; diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index facd424..8046f9b 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -515,6 +515,7 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = { S(IPI_CPU_STOP, "CPU stop interrupts"), S(IPI_IRQ_WORK, "IRQ work interrupts"), S(IPI_COMPLETION, "completion interrupts"), + S(IPI_CPU_BACKTRACE, "Backtrace interrupts"), }; static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)