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: 10332015 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 A532B6020F for ; Mon, 9 Apr 2018 21:07:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97F3128923 for ; Mon, 9 Apr 2018 21:07:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C99D28BEC; Mon, 9 Apr 2018 21:07:29 +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 mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 9A89E28923 for ; Mon, 9 Apr 2018 21:07:28 +0000 (UTC) Received: (qmail 32255 invoked by uid 550); 9 Apr 2018 21:07:26 -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 32012 invoked from network); 9 Apr 2018 21:07:22 -0000 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=UkXzA3qQZjI7XITmqGDWU58CpDbgE+zKJECqXloWIO+GtKKRnLNhKQTFWjB/bPHIWO cnMeUosGZ94ck275cOoAA51Fl2PnMnlhgJnoS5tV5U7ALhuOP/n/93azbu39/Hq6CFlu 0i2l943SR7S2NgvAw6bnNo2aj2YzAl9edhDqGIcMtGwsLFmtvQlMlbKJIOUDMK6kXDS5 TBChaRSK46DpDVgWD0dvpeugRzhcYSFFSGJx3iD79tSGpUCmCPF+uB+VOD2UklpiUw4t qdkJ4Jr6HjO3y4bt1Y/89DOZheE+8KuHo9QvpCM/lQNzcRnh6fyiKUR0bPlQnchJm+NH ia5A== X-Gm-Message-State: ALQs6tCI1xug//J/SV+3P7WzAPJIZEnLqos6ASlXBB7asQpLcKdBzNPx EHSSIdzyy+kMZEC461nHi3wfRpouLcg= 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) From: Laura Abbott To: Russell King , David Airlie Cc: Laura Abbott , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Kees Cook 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-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);