Received: by 10.213.65.68 with SMTP id h4csp3087645imn; Mon, 9 Apr 2018 14:11:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+yI/XV0uPQJnurLi4b0Ulxi2kVwPTQMZGIciqWWvGkyMuS4Ypp5IIogoxltj4gFZ9j7WTn X-Received: by 10.99.102.196 with SMTP id a187mr10914051pgc.349.1523308314159; Mon, 09 Apr 2018 14:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523308314; cv=none; d=google.com; s=arc-20160816; b=Ha/0dhBNmIVEvOTfeA9xLcYHm/CGRB9a5mY1g362kaA4fJW6UD5+9wksxDxD4T872+ IS/DBPsuK7an4WnkSN5LNBit5uPVV/PlUmNQwgudp1NV81Mo7H1NyqrJybXQvvNolemA aBGRlUosgUT8WdQzmGjBsqDszUwfrpg/3HRbgqGUD+s4x7JmQsZfF76+2fd6aey3Pup6 KNRVMbc9JwOnsiTBQ8+sqwAYJDdqk3qDizYz/W2K58O0pNw4oUTTjXPY1uwF5IFvYSjJ N+RZptXOHM9TxA+/+9xpYaPdOoaQT82AJvp4GzS7vaIQbqBKDbO/lcr2BLzQiHXWtDm3 bdPg== 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 :arc-authentication-results; bh=ft8euLnYqYFE3+0oIj+O4FrUx+5GzgMA2wcdWZG5Gds=; b=NHca/yWXv3N9ykic3TbqsVa8RXQ+vKIRSJW2znR2RxsleXOAoPmaVl6tda1nyTjcXc V7oQQI2FttwX3nUQL/LB51V5d2tZFhd5hQiFkoVFP1uRSGihHN3eQ+igSQSbWJZ14p0/ rAIclMaSD2KnTfVbMudaTZYYRAYnlYDGOuaZqYJblzX9o26UPWsIugg7EU2yEgdLS49a iG1HpicwVvylzxXrNnZrsHdBYKW9pwtVe3+owl04X0v8sKNF30ALFqSt9P4xbc4Txx9E UPI4SMsVHmOC1Etue+VdYvimObjcnk+hko8WucyoUVaJb3K3qGK8R+ONyaRLIy+jN6MO 1jwQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i84si858830pfk.233.2018.04.09.14.11.17; Mon, 09 Apr 2018 14:11:54 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754699AbeDIVHN (ORCPT + 99 others); Mon, 9 Apr 2018 17:07:13 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:39305 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbeDIVHL (ORCPT ); Mon, 9 Apr 2018 17:07:11 -0400 Received: by mail-pf0-f193.google.com with SMTP id c78so6441758pfj.6 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=LStzinm0dwDDNbYFaH0q9DHEF3cKsdjk8l51hIZlcvUILiIeJW5RmqoXf5Bvckd7P/ BH3b1jmasIa1A7FFV0eRxMf11/dET/0U6PkDLY2qwdRGC2ldxQ50NFx4BtqkhuVJ33BW n33ZUDwEFlGdC69hADACq63diky5z3xHUVJ2Y3tL0FJ/3dzsdVOw3YtqQHaI1Od6afks 9Cz5H13vxYpJzd6LdS5BCO6RPva1nFGARqECfWyLiSMkY0XEh1fzlFyGsDG1destc/EL zEmdL8vq2dxyEqcXDNJetrimrtj4xw+wiHwphz3YcqMFMqPVTXI+Up3h7S7k8cayfZ0l Jykw== X-Gm-Message-State: ALQs6tD6BCx7FlSX1tXDFQtX0xOebR4tEnLFVSW06vfxpKDKuhPf7/de 5poPr4z4ZJTWnpb3rzzQGhDRZg== 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 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.14.3