Received: by 10.213.65.16 with SMTP id m16csp208925imf; Mon, 12 Mar 2018 00:24:02 -0700 (PDT) X-Google-Smtp-Source: AG47ELtCRL4LL98oRvbk1ZxHGRZhTjs0188W2XboeQNbLJ8Fkk8WQYamI6TKjLh7CeQqUbNHz4QF X-Received: by 10.101.68.82 with SMTP id e18mr5792903pgq.329.1520839442031; Mon, 12 Mar 2018 00:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520839441; cv=none; d=google.com; s=arc-20160816; b=U1RMZBXw+2QCM3tpXrCb826MzbMQVqTQGJ6If6tlw/eObBa/4GDRLdwh9w3kVcxTt/ kw0KX7brT+B9tNhLkBV5Dt+f+RyJnRHY85HZRpIXPSXup02+1NhiAB9/hjxHuvMd0GgY zdsG5OcY0ghTRY45eaU2lcGarMoM9ad3oePQmr5FxAGRWy/LRwGNCmE+dFq6VLRrTfeg Rm+DLbb87A2HxVeQgT5ZuwL4sQ0z098y3icKtM3IOAl/HIxQx+a8t5ZMeccUgJK5Bvo3 tA+10/qUQlx0DoEV0gr+zqHu2rvK09R/wSIj7tFhgpT2A/UA775qyGiY1jlysTxsBIA3 DZhw== 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=qFmRZ4InlsOIi+TUyCUrQpTQhnr06YdhUplOMDsgPew=; b=Pt9cvU45kfCabd0uNGnMNWeevntlr/zsexsI8qoIlHvQEIgu0FuQby2gxoe0CyIrMV uFVT4jXICcLxS3Iu2POS7lT9hGgEa8aBwvJRGJpln+vJ+gUX8kXxet0AZiNkMxj0yKKQ AxAbobu05j4D8o8Ll6pevdd6kiytwc0WVy24o/SbNRIhtBNl1nM9JagW27M/cx7GMR/i QkDdEtOT7QNz0TH1O4GoWtTAJnGhabVOBGIaOJtG3w2hNNa7dOAiqDsTvrdoqV+Gs66L oifQ0YrA9kZ8J1d2G0/KF+tWwtPKcoEjvHPaVulCxt1tTTLfwGdiMrxUR1gg0Gb9KVW3 24pA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v77si5282330pfa.108.2018.03.12.00.23.46; Mon, 12 Mar 2018 00:24:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932628AbeCLHWr (ORCPT + 99 others); Mon, 12 Mar 2018 03:22:47 -0400 Received: from mx0b-00176a03.pphosted.com ([67.231.157.48]:38276 "EHLO mx0a-00176a03.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932533AbeCLHWp (ORCPT ); Mon, 12 Mar 2018 03:22:45 -0400 X-Greylist: delayed 4459 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Mar 2018 03:22:45 EDT Received: from pps.filterd (m0048205.ppops.net [127.0.0.1]) by m0048205.ppops.net-00176a03. (8.16.0.22/8.16.0.22) with SMTP id w2C62vau044421; Mon, 12 Mar 2018 02:08:25 -0400 Subject: Re: EXT: [PATCH 3/4] gpio: Remove VLA from xra1403 driver To: Laura Abbott , Linus Walleij , Kees Cook , Semi Malinen CC: , , References: <20180310001021.6437-1-labbott@redhat.com> <20180310001021.6437-4-labbott@redhat.com> From: Nandor Han Message-ID: <2ba65a3e-3bc9-d709-caf9-f0c512d718a3@ge.com> Date: Mon, 12 Mar 2018 08:06:00 +0200 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: <20180310001021.6437-4-labbott@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [3.159.212.192] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-12_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803120071 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/18 02:10, 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 > --- This looks good to me. Reviewed-by: Nandor Han Nandor > drivers/gpio/gpio-xra1403.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c > index 0230e4b7a2fb..8d4c8e99b251 100644 > --- 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]; > + int *value; > int i; > unsigned int gcr; > unsigned int gsr; > > + value = kmalloc_array(xra1403_regmap_cfg.max_register, sizeof(*value), > + GFP_KERNEL); > + if (!value) > + return; > + > seq_puts(s, "xra reg:"); > for (reg = 0; reg <= xra1403_regmap_cfg.max_register; reg++) > seq_printf(s, " %2.2x", reg); > @@ -154,6 +159,7 @@ static void xra1403_dbg_show(struct seq_file *s, struct gpio_chip *chip) > (gcr & BIT(i)) ? "in" : "out", > (gsr & BIT(i)) ? "hi" : "lo"); > } > + kfree(value); > } > #else > #define xra1403_dbg_show NULL >