From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6036BC433EF for ; Fri, 1 Apr 2022 10:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244993AbiDAKNq (ORCPT ); Fri, 1 Apr 2022 06:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244608AbiDAKNm (ORCPT ); Fri, 1 Apr 2022 06:13:42 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B75926E01C; Fri, 1 Apr 2022 03:11:52 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DFC4F12FC; Fri, 1 Apr 2022 03:11:51 -0700 (PDT) Received: from bogus (unknown [10.57.43.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 264DE3F66F; Fri, 1 Apr 2022 03:11:49 -0700 (PDT) Date: Fri, 1 Apr 2022 11:11:47 +0100 From: Sudeep Holla To: Liviu Dudau Cc: Kees Cook , Lorenzo Pieralisi , Russell King , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ARM: vexpress/spc: Avoid negative array index when !SMP Message-ID: <20220401101147.xtweqtftmtwa3txk@bogus> References: <20220331190443.851661-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 01, 2022 at 10:28:29AM +0100, Liviu Dudau wrote: > On Thu, Mar 31, 2022 at 12:04:43PM -0700, Kees Cook wrote: > > When building multi_v7_defconfig+CONFIG_SMP=n, -Warray-bounds exposes > > a couple negative array index accesses: > > > > arch/arm/mach-vexpress/spc.c: In function 've_spc_clk_init': > > arch/arm/mach-vexpress/spc.c:583:21: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds] > > 583 | if (init_opp_table[cluster]) > > | ~~~~~~~~~~~~~~^~~~~~~~~ > > arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table' > > 556 | bool init_opp_table[MAX_CLUSTERS] = { false }; > > | ^~~~~~~~~~~~~~ > > arch/arm/mach-vexpress/spc.c:592:18: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds] > > 592 | init_opp_table[cluster] = true; > > | ~~~~~~~~~~~~~~^~~~~~~~~ > > arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table' > > 556 | bool init_opp_table[MAX_CLUSTERS] = { false }; > > | ^~~~~~~~~~~~~~ > > > > Skip this logic when built !SMP. > > > > Cc: Liviu Dudau > > Cc: Sudeep Holla > > Cc: Lorenzo Pieralisi > > Cc: Russell King > > Cc: linux-arm-kernel@lists.infradead.org > > Signed-off-by: Kees Cook > > Acked-by: Liviu Dudau > > Sudeep, can you please take this through your tree for sending it to arm-soc? > Sure, I will do that as soon as -rc1 is out. -- Regards, Sudeep