Received: by 10.213.65.68 with SMTP id h4csp666566imn; Wed, 28 Mar 2018 10:28:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx493dt4r0wtZxAkU2ECzaYu68BI1wqWdQHMBgMb/3dIUwKXxm5+lecbV0ZIXY2WJ+jxkvsPA X-Received: by 10.99.66.135 with SMTP id p129mr3224180pga.220.1522258110826; Wed, 28 Mar 2018 10:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522258110; cv=none; d=google.com; s=arc-20160816; b=0LtK/ncLyiaNE8xc+JbMc+RirOFs6sUdW7WFhmfyb2vlOb94CFZCYtz8pVkzJOBJ2G maSnrmkIVRKQf/TAg/D9GbdDJl0/gUmcYvWCAWDMhJ0g/zFJdJagkYdJaSSk6VUgjqe4 XQR9GbFZhjmiDD12/3KCVqCzoulOq9AXYRff9oXlpQTmABFGt04U1ZuMYRKqU/Y4IxLV SInkA4DkLbzTB1B2Gt/SF30AEeBGyH+vrHHsxjxcdtqpWF+ZsmOOgAEwcrWYYIfGUvZ4 SrygO4e5F5nnzyxvBS5n5ZpaxGuPSrdy3dxxYZPSl5AN2AVCzMZTX5OMbYLeT0W/kgKa 9HHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=jYRj05PWGR0ZEkGV2hPsj+r4dS8rjyY3Lq/IrfYyOx0=; b=h3TmWwNcQ1fuU89q2n1Hd11hrQIZcdxdrKD+AgSD51MCbyhSqil68306x5JV0VG/h2 ZaNLxbm9zihGYYz0mvT5s5eHipCQmYvsswVl1fviOpXSRCW5G8i3vLZNVasZcdzEIwg9 JEqLe9L+417q1hMcYIWJngep3TNxyha+mTGSaP+VsEJZLyixa14HOHyv/cesoIV2ZdM6 HK0+PSe+aLPrgab7G/023/47eaZc/aGFJTAd360DUiYPStwXI+h20usF16AZqudUUxmg NueHZn1KVY6yic2PCmHeay4OAz7WUuegXL0UJVngHXfCxtHWzUYi0IsIAwdpDE96DUNf luCA== 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 b9-v6si4122619pla.32.2018.03.28.10.28.16; Wed, 28 Mar 2018 10:28:30 -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 S1752826AbeC1R1N (ORCPT + 99 others); Wed, 28 Mar 2018 13:27:13 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:41090 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbeC1R1M (ORCPT ); Wed, 28 Mar 2018 13:27:12 -0400 Received: by mail-ot0-f193.google.com with SMTP id i28-v6so3489865otf.8 for ; Wed, 28 Mar 2018 10:27:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jYRj05PWGR0ZEkGV2hPsj+r4dS8rjyY3Lq/IrfYyOx0=; b=Yvnb9DXY0Ef+pIKXb+HAv/SYUbBpzff4/CFdIo1z5YbEdGzOFzD277bOOUGpZZ4P39 AR29XrGTGYgBBoLxEU309cq1bUVH6FaPZ3Z+TajFR3nL2gHdtXyeqPik1E6pcSvpjAK0 oCTUPmTz3tAI/Q3KBO2E94IamYTmJ+E9xNGyWJgr3ybEZm9NEW9Upb3V2/E3yyRPptpe ++05G+KsiOexdAJdO3ek0xU9YAvD0JD0lpB21b6OGi8W5vsmMqQalYQZ4Bn3vS/kgTMQ wD6Ww137yq3SglypS2G+28mRG+4JjKgsc9Wrlqt1ZR975zXj0Wo//a1HhVDpSOn/HnPp Q3ig== X-Gm-Message-State: ALQs6tD/N2HBI7u55NX/Dn8elJ3lct9ebHk6b/aOzFPHX3O2qO1AJX20 EdYCECW53Cas1Bohz+7PjxTdug== X-Received: by 2002:a9d:3f9c:: with SMTP id r28-v6mr626828otc.289.1522258031678; Wed, 28 Mar 2018 10:27:11 -0700 (PDT) Received: from ?IPv6:2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0? ([2601:602:9802:a8dc:4eb2:6dae:ab32:e5b0]) by smtp.gmail.com with ESMTPSA id t1-v6sm2208363oth.75.2018.03.28.10.27.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 10:27:10 -0700 (PDT) Subject: Re: [PATCH 3/4] gpio: Remove VLA from xra1403 driver To: Geert Uytterhoeven Cc: Linus Walleij , Kees Cook , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , kernel-hardening@lists.openwall.com References: <20180310001021.6437-1-labbott@redhat.com> <20180310001021.6437-4-labbott@redhat.com> From: Laura Abbott Message-ID: <90ca44b5-52d0-be74-f36c-55d6f4a9bf25@redhat.com> Date: Wed, 28 Mar 2018 10:27:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Laura