Received: by 10.213.65.68 with SMTP id h4csp669684imn; Tue, 27 Mar 2018 06:42:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4//zyY4kAKnykQ2zL8No2UX2VgWr+4EjMRineKRVeZ9SwXii7X6IVABPEwOmm3STYw+sv+D X-Received: by 2002:a17:902:b40d:: with SMTP id x13-v6mr2269534plr.32.1522158176285; Tue, 27 Mar 2018 06:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522158176; cv=none; d=google.com; s=arc-20160816; b=RIA1jaSJAWwyS2cAtYvJDCp/D91+njuGnUAw0DJY+dTnphgywlvy2G9Y6PtyxPxGAj yyjfmQEVIfHFT4/Bm9CvNTSAnMxOGBsR4xPakSXH+DkuPJqGC8HTnTIt4uWINwD9jvGy QHrfoH0eW4wxzhQ2DAIg64lmmNTBhhqU0GAdbqoF43v3Gvcmlxi501Ef6x7wbRqqvH89 EV2dDU3YfKq3r0hOtqzPiVeFyh1zfrrxfvDU6uS1ps+hnnfw88UTSQQYGmqjLo3GVifn URf9vP7O0BWUiDu/AhuIc4eR9R7VlmkZc/IjtPKPVw76T2RwcyBkzFlGcJw6d210aw3r cs5g== 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=86QHRQo7aM9dZfRQOdEmnGPdgQe6yiUgRks03IzMsik=; b=YfPvJk1Qzg7NKcjn142IOXLKT9q3YjQ0/V4DocrhLY5JgoiFgpiqdZzmPmX9csYmZh QyjCWnsxpEXZfZc7Hh/+Zya9W5K1yc0P1mS5QC8Tm2oG/6hqjtJdiKZHkbYMJ8H0FkTb Yw+qmI+o4Sdbr/727f9nPflO5fMZnZckagydaCPYFS6O3ItJb6JXzS76aWbd7vEPulTb 5xO55TeGn3rfv2eK7pqBMYF4REp51Ty53R85zv7deQ1xO4u6WznVE5HEsfhXUJAfZraw Vb6+0r5EGK5EshJQjj/t1MHY8UiFW9jMlYPLjfb4xJlvKlCICPafDW8U1VEHkkU2oVQP KoXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dfMYPZ1v; 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 u7-v6si1255240plr.293.2018.03.27.06.42.41; Tue, 27 Mar 2018 06:42:56 -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=dfMYPZ1v; 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 S1752698AbeC0Nl0 (ORCPT + 99 others); Tue, 27 Mar 2018 09:41:26 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:43572 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481AbeC0NlY (ORCPT ); Tue, 27 Mar 2018 09:41:24 -0400 Received: by mail-io0-f196.google.com with SMTP id q84so22159470iod.10 for ; Tue, 27 Mar 2018 06:41:24 -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=86QHRQo7aM9dZfRQOdEmnGPdgQe6yiUgRks03IzMsik=; b=dfMYPZ1vbj49PKDG6eqjDkmt3C3YUcRyWFMhpak1Mnez3EEFGH/6axdIF4g5zGSi9b vISUhNTEQ7C6HeRTwPH9n8F9vCyK80WuTljtR4P4MN7nqZLWDnpdOheo0Lg1PUmgYFKM AJAIsat8/KyZ7hwWgwmauCnO/e9QGF5bYRPU8= 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=86QHRQo7aM9dZfRQOdEmnGPdgQe6yiUgRks03IzMsik=; b=M4AetGW9TGT+JUf0uyHlGBJTnFpqRDw+hH/QEecyt94LOizALvLiecdKJZIEFxjso3 UdxRLzRYRGbgKAXASZ6aJGyBervNcEvL3RdzX3QCdJ0vqPr1ZAJft9HCVgaWWPwWoX/x NkYKUE85cm5lB4eKzthQ951AriV11wWnu+jIUAiXC3DciQ3DU/M8mb8igGFE37I0bZxX PDupFrk2QdDwqPhcR+lYVDg0w19l4KyKXVarg0fvmMtG2JylZs2nWZk4xqpOY1rJ0Adz p1cRcY0WCnKTVGjw2tBQQJGYUkj8Yr/KdKvOVY58KoCXphoxIieDipEMbrhIREk/24kE mnKw== X-Gm-Message-State: AElRT7FoGLJM3/hw2lJFMWV/K1jDQmq09l7zrxtgiY1/A+QeM5MHGK+n phDfRGkzTjIImV6Sy5yKBZ9Yy7mdPSq9tSk7siwcQg== X-Received: by 10.107.161.200 with SMTP id k191mr41820443ioe.270.1522158083894; Tue, 27 Mar 2018 06:41:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.207.141 with HTTP; Tue, 27 Mar 2018 06:41:23 -0700 (PDT) In-Reply-To: <90e40062-cedb-be32-ab17-56136c78dbad@redhat.com> References: <20180315180030.20001-1-labbott@redhat.com> <20180315180030.20001-5-labbott@redhat.com> <21a2e869-62fb-75ef-ae7b-a27e136696f7@electromag.com.au> <90e40062-cedb-be32-ab17-56136c78dbad@redhat.com> From: Linus Walleij Date: Tue, 27 Mar 2018 15:41:23 +0200 Message-ID: Subject: Re: [PATCHv2 4/4] gpio: Remove VLA from stmpe driver To: Laura Abbott Cc: Phil Reid , Kees Cook , Patrice Chotard , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , 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, sorry for slow response :/ On Thu, Mar 22, 2018 at 10:43 PM, Laura Abbott wrote: > On 03/18/2018 06:29 PM, Phil Reid wrote: >> >> On 16/03/2018 02:00, 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 >>> --- >>> v2: Switch to GFP_KERNEL. There was some discussion about if we should >>> be doing the allocation at all but given a) the allocation is pretty >>> small and b) we can possibly take a mutex in a called function I think >>> this is fine. >> >> >> I still think it's a bad idea. It's simple to preallocate the buffer. >> But it's up to the maintainer. >> > > I'd feel a lot more confident about doing the global buffer with > guidance from the maintainer. But looking at the platform data, the > maximum number of GPIOs is 24, or 3 banks. Maybe we should just always > stack allocate the maximum since it's fairly small. Either way works fine, global (in the state container struct stmpe_gpio) or stack allocation for 24 bits. I guess I am maintainer for this, I can test it at least. Yours, Linus Walleij