From patchwork Fri Oct 5 16:15:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 148223 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp642091lji; Fri, 5 Oct 2018 09:16:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60n/lEyBjc3eqHCGJhP6IF37boEKQ3F1KXlryTRih2/sxBRNMzuES5Xc76YEiFjEeKfHp9q X-Received: by 2002:a62:5441:: with SMTP id i62-v6mr494682pfb.155.1538756173869; Fri, 05 Oct 2018 09:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538756173; cv=none; d=google.com; s=arc-20160816; b=s0Hn17WTygtKV1xFEfjmvKyGH60NaE6njRVCralr1hTdIp9wsHmVGGHrvpl8txQZFc wjNRNC8zjsq2eMxLknkyJLYnEa2KGO6al/sVQiEh3mRsjoBlY2eycYWqVpZ/PafKZsU7 lGHsQkQZOsHdC9VJoHrmLVkuvLVLyOBziikw16b2q3w+rMjZOESllLUmROPxQiWMfkTy 1wuboY/p15aBh+DU6YZGNtNvqhIWglfzaCGLLmuP34sHCWUR/+5MQVQ5+h+D7ihcvTbG ODGP/6cpeme6sRb9SKo63PUWWOuceVookbc0MtFLMpUcUL+vkjWt8H8ebgg/O4lNyE+a CVhQ== 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; bh=4rlkshE8g2VDL7qn9eWmBVtRyuTCxNuWP+M0/bp//wI=; b=n4z8tI2MvpeVgmj2XJkDsloqd3XlwzYJ2YzWA7B66g10giH9CxMP9gdhUvS6ebjSZ9 DOyJVctf4R4VUXvStJ/Ter1ctQIHcSvzjntCHlnUUP9F44BlBV8pehWPv6hW40cauBKd 2GtCR7TyK4GeFpWQbZxwjEE+uflJMPfxTjBcfRzYtcohY7ETYvIPnWiXOeizMHSHvz7e dq7ft4EM+XO1YMDodnkVUTHdQ0rH0czOHnw+slkQ7w/W/tVUu4xxnGbexJBzzPqOeouY 9iJ9w0HR4UaudSNkt6w3SicjfScOBG7Nl+XKeaSg/t3Br7D2QiZNhIOrqrRvUiQ93Ukm 14IQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t1-v6si8594605pgf.262.2018.10.05.09.16.13; Fri, 05 Oct 2018 09:16:13 -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; 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 S1729773AbeJEXPf (ORCPT + 32 others); Fri, 5 Oct 2018 19:15:35 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:42555 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728732AbeJEXPe (ORCPT ); Fri, 5 Oct 2018 19:15:34 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MG90u-1fwP1z0jdM-00Gb7M; Fri, 05 Oct 2018 18:16:03 +0200 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MG90u-1fwP1z0jdM-00Gb7M; Fri, 05 Oct 2018 18:16:03 +0200 From: Arnd Bergmann To: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: Arnd Bergmann , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: orion: avoid VLA in orion_mpp_conf Date: Fri, 5 Oct 2018 18:15:49 +0200 Message-Id: <20181005161601.875388-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:2J/zK62TPNTB0ahRQmIca9GLKOzjXrCwYVcsu0M78+iM1YVeqZm P+G/VC7j0rRsgxwlMCBxrxEfO9EUD8IEsh3OvoW+3yo+y70cZwf06CCAObvl3vyduSNMhqd 5DEsEnlzt0zbrg51JV4UeiXQ5Ibs8t3eLOGePxZz7cLqhWo9coBQ1G8Fe+UaTMPVnGeCCQl SKEZnPQ2kT1PD2D9hxB5g== X-UI-Out-Filterresults: notjunk:1; V01:K0:3o+SQdWxcm0=:5ef6RnU5lyjEGAk8NZo3WM bP3FnN2rI8rfQEeVoFZErI55qMkYymaf/eYwCn0zFeVWxIbkDua3/gbKmtX3fXHJRTb6/ljO0 7aU0uLIMZpZd9ZyOzUCbvxLm4lNztshc6S9b+6f5NpCP25aKLYxzxhhRvjQybakAHGyqGBYJY YgupgikVmDvifYX0+xaP5wFNQjgkSEnf72S1P3Y/tkga7rD6C/D8dx6neD3DZztnYgyoCmCRL VQ1+EDJDyul2u10zNuyYPjU+GlyLF5JmgLGxPnyqstk0OtSGR7DYxy33ANWaAWgq38f+erOZY 8qovbv/sH9KNF/w46U9U24n1EMT3246KITr9aiEvevsSB89iTXWiQcNLjW+UcdApJYy2GL+D/ 5GAVJJx8ZoqSRUZaQwaE94ME7H15M0siwdiQ+9siLBaUm1AI1GMX+40jLyimNcIz18NAoRoe4 nJbcuvNixo+hpJx4VvyDdM0+0fLmZKsG/Q7jsXxnROpkmVQCV5eXMJXbedQTz3XiEGM5vhWNP VlsPDAwNhrUsyH+COjDjpH5Ro1s86xwtiijB0BcFyG+hzm8lecDvpxDFuBHkWs6cZN4UHcCUm MoVpb+oyF7k8PhgcxnywuwY+rwTqxjhXpy5hrn5zJyVV2K8n3eWypRJiwFqg3nE4iyCN/lxQY kp/a49xGNQ6UD/tnAbcmgjlRpNbY1xQtkJnsBsZZgOXlb9iDONS2v6G+ta5vYI0IlsPE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Testing randconfig builds found an instance of a VLA that was missed when determining that we have removed them all: arch/arm/plat-orion/mpp.c: In function 'orion_mpp_conf': arch/arm/plat-orion/mpp.c:31:2: error: ISO C90 forbids variable length array 'mpp_ctrl' [-Werror=vla] This one is fairly straightforward: we know what all three callers are, and the maximum length is not very long. Fixes: 68664695ae57 ("Makefile: Globally enable VLA warning") Cc: Kees Cook Signed-off-by: Arnd Bergmann --- arch/arm/plat-orion/mpp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.18.0 Reviewed-by: Andrew Lunn Reviewed-by: Kees Cook diff --git a/arch/arm/plat-orion/mpp.c b/arch/arm/plat-orion/mpp.c index 5b4ff9373c89..8a6880d528b6 100644 --- a/arch/arm/plat-orion/mpp.c +++ b/arch/arm/plat-orion/mpp.c @@ -28,10 +28,15 @@ void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask, unsigned int mpp_max, void __iomem *dev_bus) { unsigned int mpp_nr_regs = (1 + mpp_max/8); - u32 mpp_ctrl[mpp_nr_regs]; + u32 mpp_ctrl[8]; int i; printk(KERN_DEBUG "initial MPP regs:"); + if (mpp_nr_regs > ARRAY_SIZE(mpp_ctrl)) { + printk(KERN_ERR "orion_mpp_conf: invalid mpp_max\n"); + return; + } + for (i = 0; i < mpp_nr_regs; i++) { mpp_ctrl[i] = readl(mpp_ctrl_addr(i, dev_bus)); printk(" %08x", mpp_ctrl[i]);