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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B990C433E1 for ; Tue, 23 Mar 2021 12:57:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFDF4619C4 for ; Tue, 23 Mar 2021 12:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231450AbhCWM5V (ORCPT ); Tue, 23 Mar 2021 08:57:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:41338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231475AbhCWM4y (ORCPT ); Tue, 23 Mar 2021 08:56:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DE8A619B8; Tue, 23 Mar 2021 12:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616504213; bh=JV3WAjemhG4S+sdfwTHE1VntgQXalZBY5SjRSt0aTaM=; h=From:To:Cc:Subject:Date:From; b=MSmptEuTcdj5GSLvt1vFHdKrWUxuRjHNZpUBB3z6DguJNKeG+AQB0OJ9v30Qfg3wL hUvy8eJoIJtelH5OEYVVtc525SlbkFushCHQG5kInMk+D4J1GLG8m0puiyRMrv7QNb KQvCRsBiAZUX0pyM7+c94BZdgihEbsqsYa44qP0c718W9dOasGzb8NZJSyULTMq/v6 f/AOIogOYH9KaTdy85+ogsF5OJlxXJeuKCV2qFkbuyQVK3qEeq3sRK4rNnWeOnm1ff QKnzWVApot3bae3ytJAnysCfe3YFILe0Z9i4aPkwOFFgtYWXVeocbOX2+6ps37n0a8 /20bOmLwpqo9A== From: Arnd Bergmann To: Linus Walleij , Viresh Kumar , Sudeep Holla Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: vexpress: spc: fix uniprocessor initialization Date: Tue, 23 Mar 2021 13:56:38 +0100 Message-Id: <20210323125649.1930186-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann When CONFIG_SMP is disabled, topology_physical_package_id() returns -1 and gcc notices undefined behavior: arch/arm/mach-versatile/spc.c: In function 've_spc_clk_init': arch/arm/mach-versatile/spc.c:583:21: error: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Werror=array-bounds] 583 | if (init_opp_table[cluster]) | ~~~~~~~~~~~~~~^~~~~~~~~ arch/arm/mach-versatile/spc.c:556:7: note: while referencing 'init_opp_table' 556 | bool init_opp_table[MAX_CLUSTERS] = { false }; | ^~~~~~~~~~~~~~ It's not clear to me what the correct behavior should be, but it seems safe to just not continue with the initialization. Fixes: 2a76352ad2cc ("ARM: vexpress: Set-up shared OPP table instead of individual for each CPU") Signed-off-by: Arnd Bergmann --- arch/arm/mach-versatile/spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-versatile/spc.c b/arch/arm/mach-versatile/spc.c index 1da11bdb1dfb..1c6500c4e6a1 100644 --- a/arch/arm/mach-versatile/spc.c +++ b/arch/arm/mach-versatile/spc.c @@ -580,7 +580,7 @@ static int __init ve_spc_clk_init(void) } cluster = topology_physical_package_id(cpu_dev->id); - if (init_opp_table[cluster]) + if (cluster < 0 || init_opp_table[cluster]) continue; if (ve_init_opp_table(cpu_dev)) -- 2.29.2 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 X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF2DCC433E2 for ; Tue, 23 Mar 2021 13:00:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 367EB6192D for ; Tue, 23 Mar 2021 13:00:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 367EB6192D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4pjNVocl6wpB6GyAhoFQ6OAMy7nH/MGtiO0rXn0oK24=; b=bVLhiaUFPGikMrfbv8GtrZiB3A aOdKafX7xatvpsyoj5AGN6C1ebn+DolKrJkDlhXdj8lUf3CAs3mQgDqphnruftcGXkqPaZDDzYwXS BG+F1jWRbmAXS4aUjqkjh5b9jDoVDFMxFLAQeW2z/e+2iQ/mbx7yFTyau36XUymi374eXRhTx+wpw 844F1BdazVj1fFBSmeoLhqQir4L7vVMAGqTXmOW5O28seCyhlqB9aJJOSitvhOvw49hFxtpVhwo8I 6jmQmY783GWCHvNX7h3JVI2A6f6UoTfNJkCWxhKVvxBSu9tl1/kj0MOy5lv1eQ3x0YEubS+nYnyK1 o28vbMEA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOgcP-00EzgZ-V5; Tue, 23 Mar 2021 12:58:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOgah-00Ezb1-6y for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 12:58:43 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DE8A619B8; Tue, 23 Mar 2021 12:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616504213; bh=JV3WAjemhG4S+sdfwTHE1VntgQXalZBY5SjRSt0aTaM=; h=From:To:Cc:Subject:Date:From; b=MSmptEuTcdj5GSLvt1vFHdKrWUxuRjHNZpUBB3z6DguJNKeG+AQB0OJ9v30Qfg3wL hUvy8eJoIJtelH5OEYVVtc525SlbkFushCHQG5kInMk+D4J1GLG8m0puiyRMrv7QNb KQvCRsBiAZUX0pyM7+c94BZdgihEbsqsYa44qP0c718W9dOasGzb8NZJSyULTMq/v6 f/AOIogOYH9KaTdy85+ogsF5OJlxXJeuKCV2qFkbuyQVK3qEeq3sRK4rNnWeOnm1ff QKnzWVApot3bae3ytJAnysCfe3YFILe0Z9i4aPkwOFFgtYWXVeocbOX2+6ps37n0a8 /20bOmLwpqo9A== From: Arnd Bergmann To: Linus Walleij , Viresh Kumar , Sudeep Holla Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: vexpress: spc: fix uniprocessor initialization Date: Tue, 23 Mar 2021 13:56:38 +0100 Message-Id: <20210323125649.1930186-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_125842_418595_BB2372AE X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann When CONFIG_SMP is disabled, topology_physical_package_id() returns -1 and gcc notices undefined behavior: arch/arm/mach-versatile/spc.c: In function 've_spc_clk_init': arch/arm/mach-versatile/spc.c:583:21: error: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Werror=array-bounds] 583 | if (init_opp_table[cluster]) | ~~~~~~~~~~~~~~^~~~~~~~~ arch/arm/mach-versatile/spc.c:556:7: note: while referencing 'init_opp_table' 556 | bool init_opp_table[MAX_CLUSTERS] = { false }; | ^~~~~~~~~~~~~~ It's not clear to me what the correct behavior should be, but it seems safe to just not continue with the initialization. Fixes: 2a76352ad2cc ("ARM: vexpress: Set-up shared OPP table instead of individual for each CPU") Signed-off-by: Arnd Bergmann --- arch/arm/mach-versatile/spc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-versatile/spc.c b/arch/arm/mach-versatile/spc.c index 1da11bdb1dfb..1c6500c4e6a1 100644 --- a/arch/arm/mach-versatile/spc.c +++ b/arch/arm/mach-versatile/spc.c @@ -580,7 +580,7 @@ static int __init ve_spc_clk_init(void) } cluster = topology_physical_package_id(cpu_dev->id); - if (init_opp_table[cluster]) + if (cluster < 0 || init_opp_table[cluster]) continue; if (ve_init_opp_table(cpu_dev)) -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel