Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1321224pxb; Fri, 1 Apr 2022 10:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6sY/AXgOnEZ8KGrqZ73XqOaUYqDkHq+K9MZw9sRgkxkZxupgYrXZHCNuh9PnA6ElxFptj X-Received: by 2002:a05:6a00:1908:b0:4f7:8813:b2cb with SMTP id y8-20020a056a00190800b004f78813b2cbmr11950839pfi.54.1648832885208; Fri, 01 Apr 2022 10:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648832885; cv=none; d=google.com; s=arc-20160816; b=ygzRpOU1Vld+UBjAVAk2piR+6ZAIBCDKJUCBw3Zyc+GVCQ4gGLobDh/BXhYBCgPygF 54egm43vr0dMPDxWtCZbiw/IaXA0j0bU59l3hL4KRsVzB+r94MALtMOP5siVPN9R1YIJ HsAFcgzA1jTjG8ODRLjB+pAe6+3cRj0V1KDNs1EkxrrnZOl0VKJUJ8ly8Y/6o8/3E8Oi wv++xiH8NtTJjX+GJcwsMVVfzPTPGdxSA2MG4fJ7B3X4uOiJycQSJBMatRlYkkP4ysBr 8WilrV2bh4jYT/iHwCDaMx2568iLV1dgrZtwqL2PCvlYuOBHfnAzA9xq4yUDLEic8qfu cZFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=EDgCg3q50ZVFrZcH6SFvXpQTj/dgIbCC6yVi7HvwlZ4=; b=oV03KBefB1zO526JhCjp3WBjxR4GRMsC9YzkiMDF4YHjhH8HWQcwmF+ItP7VIj9LVz t1RxvRKlteCe4Ui2IT+6ZhsRA7hQ/ToOUgEb1A9flJpKYSI2qMRxh9QxSVgT8zBG1JQg 6lNVOAJjSKkfBGNQNSPh71mq6PogOP6EMptLq/KrC5e//n0kSRlmYV7eRHRxqvbYWzlo gY/TzA8ktGX4ZXwAG35wvmtpQ2UDbZ7qJt2F8tk9GjEbMfeIoMFAudaifuwwhbxI2wWW msxLjOz0hkmE7xTGc3CWpabLtTUEpmksvxy3xKDu5X7ou0H77kodWRKLrgVASh0ZsFFT 0nDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a170902d4c400b00153b2d1645dsi2962983plg.101.2022.04.01.10.07.45; Fri, 01 Apr 2022 10:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244900AbiDAKNp (ORCPT + 99 others); Fri, 1 Apr 2022 06:13:45 -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: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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