Received: by 10.213.65.68 with SMTP id h4csp109901imn; Thu, 15 Mar 2018 11:03:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELuUV7d4wpZ9TKiha41H3Xkbo6swHThHgoWmlDonQUtbvUfcpaDCHIfpR8eYpZ5jCcSBIzVz X-Received: by 2002:a17:902:146:: with SMTP id 64-v6mr9051545plb.30.1521136995114; Thu, 15 Mar 2018 11:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521136995; cv=none; d=google.com; s=arc-20160816; b=GP9J+8tyh6+/l7nYh1y/qQ5p8kmiKoXDUGlPqZgW4d0oJHr3oKlfqwC4rngMCjkuwr 2qHPItLMPjn+42yz9TdJCa7VcRUzDuCcgMaa6WCZK4hK4FkAKzqE+tWOAT9N3j9jfc/7 YZn5VculXgya037FIfL4ICWLHYs2aiJLzD2544F2C5BGZPmLz4ITGAF0Fcs6g5E1/b83 fckyrw14LS4WNYumhscS7ymIluVubydAzZH+wGj7YL8cvaKsNgWxNrIC9BzIPJVGiLsX 2qRKLfuLff8c3C500gUDEQDkKy6bvlxTHa441ZVJpU/dKiGFKxtbWqZzyL0UFsaE1/RK Pfjw== 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=NPn+bd/tFVjdueEmk5C7pFyl4Z5oi6dsiT5tuveRGEc=; b=ea1VXlbUTaGw4e+0QZBJMdP5uaa8nsymT3fmqwV9DESSZSKqtD9HpGf3223WUU0c+J aNU6uyOOENIXXaIoRib7VovzC5KmVH40jMghe98G8edPbodWifsmoRDhCV0n1brt+lX0 IyV4E7MT88YiA2gt2HEAJb9RQRZd43qpCZLNvM/pIWj3nu2a2z0AKnDuqQxjkUAnMxoJ bHaiYllxaRZVafDWDaI9GX2WreSnruswhxyexzzau+uIHiZAQGcoJJFouYAtJ0ZGj+zD ECjGGLU9keVvUa2t5361qOI1aC/r39dVGFSdENkq2AwWUNrLguvM1RfD867AcX5a9Xu2 1B2g== 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 l13-v6si2156750pln.437.2018.03.15.11.02.46; Thu, 15 Mar 2018 11:03:15 -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 S932426AbeCOSAt (ORCPT + 99 others); Thu, 15 Mar 2018 14:00:49 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:41837 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752653AbeCOSAo (ORCPT ); Thu, 15 Mar 2018 14:00:44 -0400 Received: by mail-oi0-f67.google.com with SMTP id g5so6456937oiy.8 for ; Thu, 15 Mar 2018 11:00:44 -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:in-reply-to :references; bh=NPn+bd/tFVjdueEmk5C7pFyl4Z5oi6dsiT5tuveRGEc=; b=YH0LmkXwg/MRgDWBNGd/J5n48pMPI8jT5xfifTG6UfuRstWtpowDAzaqHa85l2x65d bJ/DwGLJLdwTP8KgUbEBcKxEv36hfkP21bJ/Fw7cyRUPml2oXa2ahePuYFTbvOJpNWa8 rTWE30iHmIBo2/hfchbLxxnHhf109IWDV/T1Kg+h946k1RapW3KwvU31kH3Ep6d4HHFw X7CvSXuZLA3N2bsMa76HrnacRKFU3n4uP+DB30p3wnvdA2kHFMyzplYkYus5KbcsIkqj tNdS2bNkPmgrdh7/eMQX5lTe9/hgRiqA8Ii2iOfwJtyg+XrvrJY5eb19DRdFV50/k3JG EHzg== X-Gm-Message-State: AElRT7ENFGGTZ9OHtCkljN6hlExSO+XBMheUGC8uz7hVTPOf/+uTLfJZ GYjDuuuoOIFQWeI6hlepKo3iog== X-Received: by 10.84.67.153 with SMTP id u25mr6071124oiv.339.1521136843252; Thu, 15 Mar 2018 11:00:43 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::b761]) by smtp.gmail.com with ESMTPSA id 68sm1372098otj.34.2018.03.15.11.00.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Mar 2018 11:00:41 -0700 (PDT) From: Laura Abbott To: Linus Walleij , Kees Cook , Lukas Wunner Cc: Laura Abbott , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Mathias Duckeck Subject: [PATCHv2 2/4] gpio: Remove VLA from MAX3191X driver Date: Thu, 15 Mar 2018 11:00:28 -0700 Message-Id: <20180315180030.20001-3-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180315180030.20001-1-labbott@redhat.com> References: <20180315180030.20001-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 several a VLA with an appropriate call to kmalloc_array. Signed-off-by: Laura Abbott --- v2: No changes --- drivers/gpio/gpio-max3191x.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-max3191x.c b/drivers/gpio/gpio-max3191x.c index f74b1072e84b..b5b9cb1fda50 100644 --- a/drivers/gpio/gpio-max3191x.c +++ b/drivers/gpio/gpio-max3191x.c @@ -315,12 +315,17 @@ static void gpiod_set_array_single_value_cansleep(unsigned int ndescs, struct gpio_desc **desc, int value) { - int i, values[ndescs]; + int i, *values; + + values = kmalloc_array(ndescs, sizeof(*values), GFP_KERNEL); + if (!values) + return; for (i = 0; i < ndescs; i++) values[i] = value; gpiod_set_array_value_cansleep(ndescs, desc, values); + kfree(values); } static struct gpio_descs *devm_gpiod_get_array_optional_count( -- 2.14.3