Received: by 10.223.185.111 with SMTP id b44csp893212wrg; Fri, 9 Mar 2018 16:12:25 -0800 (PST) X-Google-Smtp-Source: AG47ELvsU0sqFwM19PKrggl6r0DH0ogmgokrYxEYIyYMUdtPrszVnQJYdhrVAGNf2F6s2ElJUOYf X-Received: by 10.98.36.25 with SMTP id r25mr307213pfj.106.1520640745325; Fri, 09 Mar 2018 16:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520640745; cv=none; d=google.com; s=arc-20160816; b=0xEA5E/hDBlQpvcPAFjl2hD4pIwG9g7PjkKneRp97r3pc290j1qJNEYK8Ha4UhntIs /O5QKOUxd3VM8606wpmRJPhhtPjzYcmAPSzesioNRAC0aCf8+SAW9Jn9NYDxztbK8TAN awDQLtiGj2ThbeH5ji5tQJ7LIm377MpVmbGfrnjn+ZhudTlQmZ2IU34HAbWiFfUpWpb1 5XI1dJ0bMZqPLTJl93VDjTqpq3MZXfRRvGNyo+I66On14uHQ1iam5vLslcC1OhlG2e/y exCWxTawEfmSfdinw0BStstUFagh9JXPfp9auu0Ixv4fEEDzBgdFkpjInTcuX7wSyKt4 47ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=17zt0Sf3Wd3XozX5xGu4WLBb9pLFNLfrxbzuq8iiG7g=; b=GqtZ0+4aStbXVmn4hb0cDDjnIxA0CZlsYLgY/2Nhrx8AJWmqA6zbfwJXrb1ramSuqb o6XMFp7gJlQ/Pq/jALxVsYSdgvR8JL5/VEeh94bZUJfdlH4JOwIEj7C8VtwHV3xvWkui UbIFILK+Ueiym3moIGiVsVMFxOtnCQSlkYkVi2zjUUn9usyoGLp/rZqMcGFV8oDtmEhF Y4NWPXJ6miNGomzdp/AnjQmJ/yuuze2X6xJohPMCvQBVam8IwPAJMFlK4aTcbAiWiFKX 9gjRZTEaodxYE5KQogpib5+WnOA1pUxIXouNLA5b3yGBneMR+nQXJZP26FfaqkFuPZTl pXkA== 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 b10-v6si1701117plx.355.2018.03.09.16.12.10; Fri, 09 Mar 2018 16:12:25 -0800 (PST) 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 S932804AbeCJAKm (ORCPT + 99 others); Fri, 9 Mar 2018 19:10:42 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:40636 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932764AbeCJAKj (ORCPT ); Fri, 9 Mar 2018 19:10:39 -0500 Received: by mail-oi0-f67.google.com with SMTP id c12so8266654oic.7 for ; Fri, 09 Mar 2018 16:10:38 -0800 (PST) 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:in-reply-to :references; bh=17zt0Sf3Wd3XozX5xGu4WLBb9pLFNLfrxbzuq8iiG7g=; b=bRl3QI7AObXvrDPmVaZ2VIKFUgt52i75jUEQ4cRJfPDvGMp/Ri/khTaCwJny05EQTm 1vdE81TqyW9nHei9B+c5Pt8VRwdD3YVm5sI/A+2RaH5gisxs0AvN+xObnfoselh8huyQ CCqH03q4VzWsDS+ZwDWimdI+LZvP6pBlBZeD8+hH7U7NRkHsrpHy0N7zSti5986zDVDK vb2TpySiNXFIlSzaXkmZ1IMYw4C+bvJSj3O7Tmesqgjn1NyKlQgRkYJ0pSYynJaMCLyr NzCo4FH5LwISGTp21UALR+5lwO9EjyAduSM9s1Ir/auYo98JnoQGtNvnsZKfOEoXZZMZ zlug== X-Gm-Message-State: AElRT7G+b96mkD6xzy/jyV0pAhwgma0cXqyC3cE8HOcptAHDB693Bbfc lTBuyHmhmpQM1sQOqjFGk/PQxg== X-Received: by 10.202.229.11 with SMTP id c11mr161986oih.193.1520640638258; Fri, 09 Mar 2018 16:10:38 -0800 (PST) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0]) by smtp.gmail.com with ESMTPSA id s12sm1007076oie.9.2018.03.09.16.10.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 16:10:37 -0800 (PST) From: Laura Abbott To: Linus Walleij , Kees Cook , Nandor Han , Semi Malinen Cc: Laura Abbott , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH 3/4] gpio: Remove VLA from xra1403 driver Date: Fri, 9 Mar 2018 16:10:20 -0800 Message-Id: <20180310001021.6437-4-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180310001021.6437-1-labbott@redhat.com> References: <20180310001021.6437-1-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new challenge is to remove VLAs from the kernel (see https://lkml.org/lkml/2018/3/7/621) This patch replaces a VLA with an appropriate call to kmalloc_array. Signed-off-by: Laura Abbott --- drivers/gpio/gpio-xra1403.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c index 0230e4b7a2fb..8d4c8e99b251 100644 --- a/drivers/gpio/gpio-xra1403.c +++ b/drivers/gpio/gpio-xra1403.c @@ -126,11 +126,16 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip) { int reg; struct xra1403 *xra = gpiochip_get_data(chip); - int value[xra1403_regmap_cfg.max_register]; + int *value; int i; unsigned int gcr; unsigned int gsr; + value = kmalloc_array(xra1403_regmap_cfg.max_register, sizeof(*value), + GFP_KERNEL); + if (!value) + return; + seq_puts(s, "xra reg:"); for (reg = 0; reg <= xra1403_regmap_cfg.max_register; reg++) seq_printf(s, " %2.2x", reg); @@ -154,6 +159,7 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip) (gcr & BIT(i)) ? "in" : "out", (gsr & BIT(i)) ? "hi" : "lo"); } + kfree(value); } #else #define xra1403_dbg_show NULL -- 2.14.3