Received: by 10.213.65.68 with SMTP id h4csp699684imn; Wed, 4 Apr 2018 05:55:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+v+oUOPcW8/j1iddo4jSPlfcacxEsMEJM9oa2bSxtSuNkeowHw3d1uk/LA9ubWCJ6WFMKh X-Received: by 2002:a17:902:ab81:: with SMTP id f1-v6mr18185833plr.5.1522846509093; Wed, 04 Apr 2018 05:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522846509; cv=none; d=google.com; s=arc-20160816; b=JqnecTiZ3uMrHUQOyUVuIJbnv2TB29M/AswP3L5ymUkwxFOtqe7bNVC2LwTZWKu5Tj x6rQtI1EA57BQM4gocrf3+t43anF5wkDQgJYRi78E4pD5XK2f4unUlCymvgaO7o3jQqg XtsprWaVMZP0AYHUSP0TJ+K5bEE2Bx6h36t8EDMGJ/coNB3pBwwKbAjJaPimX2ZiQeFQ 9jpajXsovfSu6tMCILhJ21sbhWcV4SDl4t3DXm2Lz/w1RrMeln2CXHR0BweRWATxZNjR NvMtGZNqHCCRiQWLSJMsg+sbSgfzK/q9Fc0nfnGjgq9kIm2D7oY6zRocAXeIbX6/1d2k YHcQ== 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=8cW3gsKXpO29gdUoCTDc9v1UX87CiTI13FQdfTWzl5Q=; b=epeZgSwLhdF9MuuH8q08/MYGKOeFexzwGop+GNp6qRrcgLZzNRWd03thUl9bkMYtWE fEDCn3UvJhZwgb5tvNA3/mYAIPnLW5L5iSc+qRaBIQFG56BMaENTuOt6Sc/uudQw/5w6 Vucg5xU9hyU6BWXSkDm+3s697AmjDGV4iyJUmqnenHwV3MCq+zsp9fS6LSqp/vhQ78nH 4KrHHo8ql9MXZHodSXMkZLJHDOA3aZ3VYQScYxkl89xZBcEMI6xe1J3YAK3u1cnZoMsU re9HnRl5F3ZV/ZlA+/0N5QBqBD0+yK4n7F85qLT81rkkQ2t+Ks0LswRj3ryNa0mE3I3e +5Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G/pU7Rzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l85si4046479pfb.231.2018.04.04.05.54.53; Wed, 04 Apr 2018 05:55:09 -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=pass header.i=@linaro.org header.s=google header.b=G/pU7Rzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbeDDMxp (ORCPT + 99 others); Wed, 4 Apr 2018 08:53:45 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:36238 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750842AbeDDMxn (ORCPT ); Wed, 4 Apr 2018 08:53:43 -0400 Received: by mail-io0-f193.google.com with SMTP id o4so26225806iod.3 for ; Wed, 04 Apr 2018 05:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8cW3gsKXpO29gdUoCTDc9v1UX87CiTI13FQdfTWzl5Q=; b=G/pU7RzlDEmQb6qVqL3N1e8aGI8JX2UIXXVHyWh9diL4lKI7xV5PlOBc9srdPjXsgV KVCYaBFuVieN9tKePCk4KGVvyI+OWiX53CBRw4Av6/ntre5Vu/p+jESjedU/dB7sbEM4 89rjxarb0yjYPEfsR6t92gjjh1lKY2xa4sw7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8cW3gsKXpO29gdUoCTDc9v1UX87CiTI13FQdfTWzl5Q=; b=BRo5SZNo8te9JLk/20kHXplbtfFSf0HJH2Ho3J3aEevnV3usYqWL72RX4O+PqGwHAz bIJx8+ox84YPY+iBihqcfMjAg0gPRhLxr6jkEyNv2XwosqrzCilc7xcj1w4YN3BoLJgY m5NvFAfJaQa00obBdViVxpZqdkRDR+NxkIM24N/7gWXKR1tdWX6t6QAA49d43hhGNKgf BAKWxe9DejyW08TxRogIYmkq+wOKnMGNnYoMcBVc5/g0fpb4zLAfPUwN5l6SopOmQaX+ TonUIfhyAhBFV3gw4kQv5yLoGeR1q7dUNOBsxbU34zD3ZOdG4spd4t4HiHgOaPV/FOnT iDKQ== X-Gm-Message-State: ALQs6tBGOstVN5r9Eig9iOucRX9r93Y8u4V9WAxl0rRVc+LE95LvU5uC 2Q/x2ifiRBhEfccN8ghwnxSJ/GPEgPSpohKwohfi663l X-Received: by 10.107.151.13 with SMTP id z13mr15023449iod.277.1522846423340; Wed, 04 Apr 2018 05:53:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.207.141 with HTTP; Wed, 4 Apr 2018 05:53:42 -0700 (PDT) In-Reply-To: <90ca44b5-52d0-be74-f36c-55d6f4a9bf25@redhat.com> References: <20180310001021.6437-1-labbott@redhat.com> <20180310001021.6437-4-labbott@redhat.com> <90ca44b5-52d0-be74-f36c-55d6f4a9bf25@redhat.com> From: Linus Walleij Date: Wed, 4 Apr 2018 14:53:42 +0200 Message-ID: Subject: Re: [PATCH 3/4] gpio: Remove VLA from xra1403 driver To: Laura Abbott Cc: Geert Uytterhoeven , Kees Cook , "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 On Wed, Mar 28, 2018 at 7:27 PM, Laura Abbott wrote: > On 03/28/2018 12:27 AM, Geert Uytterhoeven wrote: >> >> 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 >> > > I'm okay with making the change but I think Linus already picked > up the patch into his gpio trees. Linus, do you want a patch on > top of your -devel branch or should I just send a new patch? Yeah a patch on top is fine, I sent my pull request to Torvalds today so we can take this as a fix for the -rc cycle simply. Yours, Linus Walleij