Received: by 10.223.185.111 with SMTP id b44csp893662wrg; Fri, 9 Mar 2018 16:13:03 -0800 (PST) X-Google-Smtp-Source: AG47ELvP7cyIWdQR22OFsluVNXc0PYrqg29CBwIYEegQXD//isW9Uk5HkPAyQn+CVMkxnGzxKW7I X-Received: by 2002:a17:902:9306:: with SMTP id bc6-v6mr286064plb.133.1520640783746; Fri, 09 Mar 2018 16:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520640783; cv=none; d=google.com; s=arc-20160816; b=dieUFm5oakGrI+p0pQx3c0Na5HRyXiOSaVKkz5vqlhlVJPIeRUuFiK7mSE5TrpC8ue ozl8p0Y88Zi0eNHu7ZUyo7yTgkDTtVImH+VG3qmWJMITSughDDhkpOxNqeKH4N+L2tUs 0rLFAiuP4DLqaOUb5LI2qcYD5dV11hGg6kUzLDUV1oajc7Hkor/ckgvuqrvr/gnUfTL1 hmmT4OvJVAYljfplJC0863isDlFHQcMsb44GZA9S5I1Yt6hf0l1xhORgxttUduAy3JY8 ydClBVnyayN9nojoKKvNuvfHMHjh1FAXEyZIJbAibS1ddSzzH9KGy2hc8CvkVYzBS2KD OsJQ== 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=Kjh2dRWQC3XfvJzP9sKUndnJx1a6KsrfaacoJ+FnTYk=; b=fx7lwNnsk3TXkIy7Ktl/27/68gtLg1tRhJf8bdmRBAgX+KU0Ruqivdr+Tc6mGkHBEY 12X/fllaJaOO2rBKRwkP0qPhKPqNrV5JCAfurG3Gzd7esoWgxkA1fd4VR7cyWaZTuD2t tdjLrqfoss9p6SralBETlCp+ihc9ON8sUHVMlk8e9IGJpjwbsN+eEZA8yyv8JM8+vjS7 tQYF2pqLfvJ5YXSN9KCaU0/CtDL00Kjbk2sGgRJRSFNErMBNwZPXJxNA+PLunCbFmOLN N2aXnyw+tVLM4AMXf+8CLJ4kJXF4VXiX7qjUKeq5fBG3o+L5Ep590LOA5CxgYmAjHLNz KWFQ== 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 y2si1480759pgs.359.2018.03.09.16.12.49; Fri, 09 Mar 2018 16:13:03 -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 S932856AbeCJALU (ORCPT + 99 others); Fri, 9 Mar 2018 19:11:20 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:45955 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932771AbeCJAKk (ORCPT ); Fri, 9 Mar 2018 19:10:40 -0500 Received: by mail-oi0-f67.google.com with SMTP id j79so8265003oib.12 for ; Fri, 09 Mar 2018 16:10:40 -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=Kjh2dRWQC3XfvJzP9sKUndnJx1a6KsrfaacoJ+FnTYk=; b=AuSpbo+mY+W+YATpcwOre7uqQerATHyJ1SAFRpQvM1MzwUc1u/eds3tCB5tvGbBPmQ esUD5wYm7HaHvqblCCC/P0uk2P2Na48VC4boS33w+8HBqdBRxozsGyXBS/J6gTx3/MCQ wjmAjZ+8lw6fHAey7P84GblN+X/6+7Ha4u0zY6AIYn1BzoCN+XRdtl1YQIH2S3PJFzho GJKknfAxgMsxq0CnD9AluvDTgG64S9pw7kz82A2eISbdPQs0f9nf+t5gbJywEF5NXFJt oPriT6wV3ccJ96t+DOuKSFUEfqtReLmh5nMbkpBGzeRDMWXxavwzSK2V5UocH3QyqexJ 95eQ== X-Gm-Message-State: AElRT7EaCA8QtzMWXovJ2mXIaXwM8Zv1iztfPHxoWcUS19VcAoKoSmLC 9oOCkSru8gEHy8t+WpHzZd8HmA== X-Received: by 10.202.56.87 with SMTP id f84mr172611oia.254.1520640640318; Fri, 09 Mar 2018 16:10:40 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Mar 2018 16:10:39 -0800 (PST) From: Laura Abbott To: Linus Walleij , Kees Cook , Patrice Chotard Cc: Laura Abbott , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH 4/4] gpio: Remove VLA from stmpe driver Date: Fri, 9 Mar 2018 16:10:21 -0800 Message-Id: <20180310001021.6437-5-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-stmpe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index f8d7d1cd8488..b7854850bcdb 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -369,10 +369,14 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev) struct stmpe *stmpe = stmpe_gpio->stmpe; u8 statmsbreg; int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); - u8 status[num_banks]; + u8 *status; int ret; int i; + status = kmalloc_array(num_banks, sizeof(*status), GFP_ATOMIC); + if (!status) + return IRQ_NONE; + /* * the stmpe_block_read() call below, imposes to set statmsbreg * with the register located at the lowest address. As STMPE1600 @@ -424,6 +428,7 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev) } } + kfree(status); return IRQ_HANDLED; } -- 2.14.3