Received: by 10.213.65.68 with SMTP id h4csp153534imn; Wed, 28 Mar 2018 00:29:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+l2ZyAMSGIyRV0v7fMS9LkLGLpeWeFJxuro2dVrbGXhC8xYY6WwlAT+RTAyuA8CRAofev6 X-Received: by 2002:a17:902:52e6:: with SMTP id a93-v6mr2654955pli.10.1522222169166; Wed, 28 Mar 2018 00:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522222169; cv=none; d=google.com; s=arc-20160816; b=nmxUI8HMQV2Mv3nDX7qPGOVduQvOfn1x52DMxgcPLioymhEUS+B4yZd1m8r9Vky4p3 1GagkuyM82m57YVS8DAq5xOumdCF1H9ZDI0ObjKizNv95g2zKtRMGah3nHXKq3RpOdWn oUzbSCGCiIr5fRvfd//GWOz93689EZi5Aqb8x5SsRsxkTsEc6gB6ru7F2Au2VuRQ68zg ouVicI90H51HwLXUkABveqlWY1BMoCwcB9biKkkPUkwZfzI2pWvMHZNNHmOBMtlzRsmK VBOwycM7CRZm4GEUD8hk/ebImYKckp6u1Yzie9i+QsRhxlCB/aLKGWnbdqsYCnZLpRVu IZxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Z6m0r3wW2hbgtlne8Is0zoCpbTii4sVmz0mZKjfZl48=; b=Lh1ULq5kNt0dkmImvbYGcmuXwtXI13NUUQZq9mfv+xFkykrEwuTNYG516tBp72AsAw E7GI+NgvS9CJ74Qd16YQ7NKLIVjjXJ1TLASDbN42IigcPOjxsYkpWZECJ/6oXYzBOZCw 0VnB9aMZE3w2D+cbEabnzNk8J4W+9VACNzlK8cBEV+egAyJaIE3GKetgvgiwo+EfJUpe aEAYvB67E6GhotRrGG5pPnFpdZp6etj9J/6dFsy5FSRrq1G7yFEXbx4IzY7vmdeeQyGn WMClwc9G81G89joxen+0ZkW7B771XGsPnpwXozCWrzveTGyCpLrP3fUPpbWDPKOVkVSY MAdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CZE42eWm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si2039307pgp.701.2018.03.28.00.29.14; Wed, 28 Mar 2018 00:29:29 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CZE42eWm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbeC1H11 (ORCPT + 99 others); Wed, 28 Mar 2018 03:27:27 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33052 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752716AbeC1H1Y (ORCPT ); Wed, 28 Mar 2018 03:27:24 -0400 Received: by mail-qt0-f195.google.com with SMTP id i8so1570984qtj.0; Wed, 28 Mar 2018 00:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z6m0r3wW2hbgtlne8Is0zoCpbTii4sVmz0mZKjfZl48=; b=CZE42eWmV7yDKJX2B7YsbniCPuHd3kLvmQFub3K87ZD6uHx+Aud8kjCN9ETD+p7iUw DR1HwKVXqriFBlnbAZQG2t42dfW6oB34/2FkflT42gzt5rJtaJI/zdjshMTsqIQds9A/ DIrDXughD2qpsBBmMspmmWmCndHww4z4Hz1UKISQDVrPyxvF8uwV6da3RBE3JGKQpNvZ 6UZwKJselGQlpVfZmveY/7aivLb8DTj4nlqng0IRc6QbVGaHvgCNrWWe1kXrNkpXlhEg cLnDDGsyBq74qP1uFpB/VETHpOZRwc5sIKHJYKD/p2EVPFLCUDlVK/+X3Vx09ltlEyk2 TNoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z6m0r3wW2hbgtlne8Is0zoCpbTii4sVmz0mZKjfZl48=; b=hjL13PJjGz+Of+1S3C90tWlI1hiOTeJ9MAuEbFK1KPmkDuN+LWi0tGOwzaotatviha YOBb65VbwK6X3Z0tWe35YnFzMMVsWFzMzTFdxz+2rIfcduvZBLnyHknE/oEamDHjZtUP EVn8+jqfluyzOBF06nvFeC5oNhPfO0E3l0HLb0p30cqLUZZ313vcyHv8SjF9h1xun+nB MP9D0H8AtFr7U8QQxfZCXhSyp4Y5YROdXirQlB6u8k2qS297g1r8O88NqgxbI+UFdi4k 3kGfIX9SACsqElMUqZsKI1JIpXkp5HOU/SMiaSaHffB8woeJOu7KiUKN4gVn49GVN5FO 8xMg== X-Gm-Message-State: ALQs6tCzN/3D+sWOg+HHOQRGS/ZC5+zxM3R3JLbYDPGWtPWWds5QJw1s 2dan6/MWI/JsNEZ4LHUZiDJmL8yzNhwuc+gA5fM= X-Received: by 10.200.44.164 with SMTP id 33mr3800938qtw.160.1522222043543; Wed, 28 Mar 2018 00:27:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.54.147 with HTTP; Wed, 28 Mar 2018 00:27:22 -0700 (PDT) In-Reply-To: <20180310001021.6437-4-labbott@redhat.com> References: <20180310001021.6437-1-labbott@redhat.com> <20180310001021.6437-4-labbott@redhat.com> From: Geert Uytterhoeven Date: Wed, 28 Mar 2018 09:27:22 +0200 X-Google-Sender-Auth: zYy_xSutjutW0wlt81310gJ1dEg Message-ID: Subject: Re: [PATCH 3/4] gpio: Remove VLA from xra1403 driver To: Laura Abbott Cc: Linus Walleij , Kees Cook , Nandor Han , Semi Malinen , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , kernel-hardening@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laura, On Sat, Mar 10, 2018 at 1:10 AM, Laura Abbott wrote: > 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 Thanks for your patch! > --- 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]; Apparently xra1403_regmap_cfg.max_register is always 0x15? What about adding #define XRA_LAST 15 at the top, and replacing both "XRA_IFR | 0x01" and xra1403_regmap_cfg.max_register by XRA_LAST instead? That would avoid doing yet another memory allocation over and over. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds