Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1499383img; Tue, 19 Mar 2019 08:55:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5pmbROXYbhP0fiIp8cRVfa9DNBMs51YlUAnWkzn2vp0L3PewHiTuVjSETMWTAU/JM0OCx X-Received: by 2002:a62:5687:: with SMTP id h7mr2623443pfj.198.1553010903976; Tue, 19 Mar 2019 08:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553010903; cv=none; d=google.com; s=arc-20160816; b=ul0rUTSdoiJ8/QGl7xfYSP7adAJUwrtdbeQJUJW3Ny6zymgze0pO/0Ch/WlF/Swvm7 KJwuVXxyrjoXoArne3ygIgdibmMXElWk3SIJzS1oJsbIZ92ylqlbnCHuWFGOir7K02HW 8mGOcRkQe0nGrT07sI+zfxBGsAc7O3mifiW6CgQ+gwdrd7u0FurdYSgkWICdlgO0tTpg F7fMXU2vpo3O4Hrhm781ZoVGmgU1v7gPeQTH/eHT2P6i3M5HAgYYMMj6Ta/HyRUUmzG/ 8RyVIq/EbSe9Z13BAudTLr8AjT+k+01fSSHWG8PJdxZunfFi2B4I2smT8WQTqwjuAmCC HfpQ== 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 s13si7269243pgp.494.2019.03.19.08.54.48; Tue, 19 Mar 2019 08:55:03 -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 S1727196AbfCSPx4 (ORCPT + 99 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(-) 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) -- 2.7.4