From patchwork Fri Mar 9 06:21:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10269763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F40886016D for ; Fri, 9 Mar 2018 06:23:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEFE4284FF for ; Fri, 9 Mar 2018 06:23:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD4B329CCF; Fri, 9 Mar 2018 06:23:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 629682A086 for ; Fri, 9 Mar 2018 06:21:44 +0000 (UTC) Received: (qmail 32595 invoked by uid 550); 9 Mar 2018 06:21:43 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 32557 invoked from network); 9 Mar 2018 06:21:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=GsrWJOn4Y/XaLgCM4bB6TLWnXwaWY7PRDE/UaUXXb 2A=; b=XA1o/XXjPP+pcXL2GimsqBY6Gv6tVqKjbCJXOxmLAVPk9oVq+1tj/tyQA AJeFEr+dZMikEmFyUVUzNJ5Pv8l6IWrMvRPyBSHQAVsvkrvPWJd9QNnPZDPIdysB t0DHR529IXxqgQfpd0d6Q1iLbJ1yqeqKy8cFOjdOL9Gq+fw9U6oJkt1hkfWcxAh/ RSZF88bGJoENigxKNBtf6jTva3t8KCep2O+3gkYdmjFsUUSk9fxvPW9t/ilHqwMW QAuptcnABgZADnlYW1uWftivtmMn7Yz1B/vRFdlq2ElrLldl/zEz+XN3piLMIuGN 5LmZZpSLsXDe/c0vjn5DJe0ajIhSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=GsrWJOn4Y/XaLgCM4 bB6TLWnXwaWY7PRDE/UaUXXb2A=; b=GnKpbickTwOW44Q7XOyX+bU81OLmE45i+ e+hgmQCtyUpSQFHTzkb9WlOrihPC0HIeV26YcsF8myMG3wkehO6A9fQ/a1uvpNnn e/smTJHEPgkHjKU7+9wtTPF8F4SgAGShgCx0Y+co/12v5xcP+LKiaHzGlbFjz2wH 7t4/D8J1Y7lQ53CgOUe/hDEKhFd/6KpK9f2cFlnpSjIGFzcGD1zzdwTnCDa1vCV8 t+e3BztGgc3Vx129JfwYdvifU42WMMv4zT8Mz9txtBR0P8X8Y1Z8Oc9d6D7gs80S RySj7bTbRcgUTSxWMNCH/w7gjiSSU29YYr6/2IwOgx+siPLaxhdaA== X-ME-Sender: From: "Tobin C. Harding" To: Greg Kroah-Hartman , Eric Anholt , Stefan Wahren Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, Tycho Andersen , Kees Cook Subject: [PATCH] staging: vchiq_arm: Clear VLA warning Date: Fri, 9 Mar 2018 17:21:10 +1100 Message-Id: <1520576470-20628-1-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP The kernel would like to have all stack VLA usage removed[1]. The array here is fixed (declared with a const variable) but it appears like VLA to the compiler. We can use a pre-processor define to quiet the compiler. [1]: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Tobin C. Harding --- The name of this constant may need changing, there is already a pre-processor constant VCHIQ_MAX_SERVICES .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index f5cefda49b22..c972869a0333 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -3434,13 +3434,15 @@ vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle) return ret; } +/* Only dump 64 services */ +#define VCHIQ_LOCAL_MAX_SERVICES 64 + void vchiq_dump_service_use_state(VCHIQ_STATE_T *state) { VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); int i, j = 0; - /* Only dump 64 services */ - static const int local_max_services = 64; + /* If there's more than 64 services, only dump ones with * non-zero counts */ int only_nonzero = 0; @@ -3455,7 +3457,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) int fourcc; int clientid; int use_count; - } service_data[local_max_services]; + } service_data[VCHIQ_LOCAL_MAX_SERVICES]; if (!arm_state) return; @@ -3466,10 +3468,10 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) peer_count = arm_state->peer_use_count; vc_use_count = arm_state->videocore_use_count; active_services = state->unused_service; - if (active_services > local_max_services) + if (active_services > VCHIQ_LOCAL_MAX_SERVICES) only_nonzero = 1; - for (i = 0; (i < active_services) && (j < local_max_services); i++) { + for (i = 0; (i < active_services) && (j < VCHIQ_LOCAL_MAX_SERVICES); i++) { VCHIQ_SERVICE_T *service_ptr = state->services[i]; if (!service_ptr) @@ -3499,7 +3501,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state) vchiq_log_warning(vchiq_susp_log_level, "Too many active " "services (%d). Only dumping up to first %d services " "with non-zero use-count", active_services, - local_max_services); + VCHIQ_LOCAL_MAX_SERVICES); for (i = 0; i < j; i++) { vchiq_log_warning(vchiq_susp_log_level,