From patchwork Mon Apr 9 21:07:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10332011 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 B1E676022E for ; Mon, 9 Apr 2018 21:07:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A431F28923 for ; Mon, 9 Apr 2018 21:07:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9900228BEC; Mon, 9 Apr 2018 21:07:14 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E9C028923 for ; Mon, 9 Apr 2018 21:07:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D9956E14E; Mon, 9 Apr 2018 21:07:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AFB96E14E for ; Mon, 9 Apr 2018 21:07:11 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id l27so6433698pfk.12 for ; Mon, 09 Apr 2018 14:07:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ft8euLnYqYFE3+0oIj+O4FrUx+5GzgMA2wcdWZG5Gds=; b=Bus9ZXNsxRMSgPstY4UddUgN/foWhsBLspGWevjtQY3O8jdX7v2sGlCXMUDlTsbms7 jMsrSibuWTRHJubzvQXZBNEWqkqOmbqZQSke6FKXKc8BOHXch9XAzJKfuNxvMDPZQENE 8iqq+9c2SpUDLaJFYa0ozBBMRG4iYhElZIoHAwbBHCRBJkv201uaTu0VwwuI3livQKpi vglC/kQDLxz9i7AImD4zVCSOHTQzRF8BqkvMBhyPG+wcj+LJUdGdNwp+Iw0Xpr3oDYj9 EXKhAu/wby7lqFaSnEnWvPpqhjZ7WZWZhDUGbvN8md2mH43/42SXClUFz0Uq6vnIckx3 kGzw== X-Gm-Message-State: ALQs6tCogzyLjjQTlkpUK1GvCX9/uNSk6cXQQwiO+iNAH5HPf6iwXokc yHZ8/PuhWGq3SkSCMHsrr4PRDA== X-Google-Smtp-Source: AIpwx49T3Unh4Ts7XesWS8MIH4z2ZcnWjTBM3UXZHxo5ELgJIih0FPKz77v4INxSoytgx369/9mTVg== X-Received: by 10.98.103.69 with SMTP id b66mr392687pfc.151.1523308030981; Mon, 09 Apr 2018 14:07:10 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::1082]) by smtp.gmail.com with ESMTPSA id d12sm1646603pgq.41.2018.04.09.14.07.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 14:07:09 -0700 (PDT) From: Laura Abbott To: Russell King , David Airlie Subject: [PATCH] drm/i2c: tda998x: Remove VLA usage Date: Mon, 9 Apr 2018 14:07:03 -0700 Message-Id: <20180409210703.3787-1-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel-hardening@lists.openwall.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. The vla in reg_write_range is based on the length of data passed. The one use of a non-constant size for this range is bounded by the size buffer passed to hdmi_infoframe_pack which is a fixed size. Switch to this upper bound. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott --- This one really feels like it should be a #define but I wasn't sure where the 32 came from. It looks like most other uses use one of the #defines in include/linux/hdmi? --- drivers/gpu/drm/i2c/tda998x_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 9e67a7b4e3a4..29e2f49601c7 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -470,7 +470,8 @@ static void reg_write_range(struct tda998x_priv *priv, u16 reg, u8 *p, int cnt) { struct i2c_client *client = priv->hdmi; - u8 buf[cnt+1]; + /* This is the maximum size of the buffer passed in */ + u8 buf[33]; int ret; buf[0] = REG2ADDR(reg);