From patchwork Sat Mar 10 00:10:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10272611 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 3D04E60594 for ; Sat, 10 Mar 2018 00:11:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C0A52A043 for ; Sat, 10 Mar 2018 00:11:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ADBC2A050; Sat, 10 Mar 2018 00:11:06 +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=-4.2 required=2.0 tests=BAYES_00, 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 3D8222A043 for ; Sat, 10 Mar 2018 00:11:05 +0000 (UTC) Received: (qmail 24269 invoked by uid 550); 10 Mar 2018 00:10:49 -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 24106 invoked from network); 10 Mar 2018 00:10:47 -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:in-reply-to :references; bh=474AYZ35G8oYHx5uigfs25WvIcdFL+8l79GX75PnAwU=; b=WO3MrklGHdLoipzE/jjKrHqS9TGEozCUB+SPA7YhfjLEGOS8x8uXNIhCKO9d69I3Ef 1vokjf2hyQoT5X6dmiP0P5EY72Cy3rFG7BroEm35Jy65ag8xiO2DYpTryqeZwI7/ERPZ 4qO0qGrFID3sWJ6pTimQgl63F65fhOc14SyxMBbf5hwKIsmYse9uNX1yB9t6Vyh/tLiy w6JouMRNxZWJlHxmkg0mb/cXO18nERk5h/8zISuEbS7dOIFsh97H9dV2NBpLUT2UVvPg lPEdOtiOngVmUgCZStY9vPXPt7K28YNH6XRYUbP4TiBi9H9BH9BOU6sV9abL0TyF7VGc Hlow== X-Gm-Message-State: AElRT7FZEAmE7lQtOpwLOYwHZcnVUc60cEjGEeor/CaqDEkGH7kyTpWK d4oVXVZb8R5aOp8RxCIjA/3Whg== X-Google-Smtp-Source: AG47ELtmSv7r9PaZS2MrGkgpU3k1TQTzASl9NlrX8S4vN45UfyElI9Ff4pntq4knqUpQF5/X25553g== X-Received: by 10.202.16.14 with SMTP id 14mr153290oiq.341.1520640636235; Fri, 09 Mar 2018 16:10:36 -0800 (PST) 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: [PATCH 2/4] gpio: Remove VLA from MAX3191X driver Date: Fri, 9 Mar 2018 16:10:19 -0800 Message-Id: <20180310001021.6437-3-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> X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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(