Received: by 10.213.65.68 with SMTP id h4csp1587502imn; Thu, 29 Mar 2018 07:27:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oiPdtCZLluTbzk5DZPZUm7PbtPtiattU/WLT5hAd04WMLZCm4OL87NGQwe0XzpomoT4d6 X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr8376755pld.59.1522333641284; Thu, 29 Mar 2018 07:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522333641; cv=none; d=google.com; s=arc-20160816; b=R+BnhFOszeuKu/ymh7MYa9uzWC4SEqWFks9IhHANxE1Y17ioiQJm2a1HpBnvrT9/dP b2VmFphxZP3LSmWX7m22Exgx9i+gYa/PxmZYFKVwQaNp5JmWoChPJxJD/ubCPuI4Gwvp FiKdM+jVyvjccZrc7J3uNxTZ4b9oNioapQfDn1SdPW85usULUtiCghDHfmBbokdKWYxb FGP2l7nHkgEqUcfJYeO0fOG+czv05dMCHa3GWRz6MfquRrsQ15Siaan1XqbtH99EdbNK HvaK8WAd4AfNUp4vhxvGaMINXPa/peTEfucPUGQqsX57KI/BGuDhOMSJsJKKz7qGYguV mLCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=2YiFcGSh56kIueVXE1OUKezUwQfERPxDTGafgmrD4sI=; b=x2kVC/OsYGvedPFY4pdOmhATXI9LORGCiLayzHU87TcAXgYizlLuFdIR9VEJuS3SFH YywPz4M/Z2EspidshP0EFi8h66qX5NeGNN5qNrm3xguxPMPpEWEJI1isk+6X86LrLmKJ hON0KvNkJyGnxGBp0dRj3bMi/Pz3HfislvxVSPzSN9ajMT3hi/GTD5GdRflAufTs5tFR ktGPrf2//o5nzfWE0vVjDRtAtVb1N4UN6zs+Wwk/K7f5x1wu1GpQAMltGfqZCnAQgUrS ppQlI1sNEUCv++C49D7vnqIGUx4LgPqRQY1JWPS664K6uCQttx11ez1FNsE1ta3R6A0l vXwQ== 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 k8si4108280pgs.555.2018.03.29.07.27.07; Thu, 29 Mar 2018 07:27:21 -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 S1751862AbeC2OZh (ORCPT + 99 others); Thu, 29 Mar 2018 10:25:37 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:51415 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750866AbeC2OZf (ORCPT ); Thu, 29 Mar 2018 10:25:35 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 6D079100FC144; Thu, 29 Mar 2018 16:25:34 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 096EC5BD4; Thu, 29 Mar 2018 16:25:33 +0200 (CEST) Date: Thu, 29 Mar 2018 16:25:33 +0200 From: Lukas Wunner To: Laura Abbott Cc: Linus Walleij , Kees Cook , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Rasmus Villemoes Subject: Re: [PATCHv3] gpio: Remove VLA from gpiolib Message-ID: <20180329142533.GA15478@wunner.de> References: <20180328181809.24505-1-labbott@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180328181809.24505-1-labbott@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 11:18:09AM -0700, Laura Abbott wrote: > The new challenge is to remove VLAs from the kernel > (see https://lkml.org/lkml/2018/3/7/621) to eventually > turn on -Wvla. > > Using a kmalloc array is the easy way to fix this but kmalloc is still > more expensive than stack allocation. Introduce a fast path with a > fixed size stack array to cover most chip with gpios below some fixed > amount. The slow path dynamically allocates an array to cover those > chips with a large number of gpios. > > Signed-off-by: Lukas Wunner > Signed-off-by: Laura Abbott > --- > v3: Split out from the series since patches have been picked up > independently. Fold in patch from Lukas Wunner to introduce slow/fast > paths. I took his suggestions to go with 384 as the maximum number of > gpios. Also fixed one 0-day bot issue where I forgot to change the > return type. I've just given this a whirl with gpio-hammer and it works nicely, so FWIW: Reviewed-and-tested-by: Lukas Wunner Thanks a lot for doing this Laura, and most of all thanks for the proverbial "dogged persistence and patience"! (https://lwn.net/Articles/697029/) Lukas