Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756910AbdCUIoK (ORCPT ); Tue, 21 Mar 2017 04:44:10 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:34624 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755004AbdCUIoI (ORCPT ); Tue, 21 Mar 2017 04:44:08 -0400 MIME-Version: 1.0 In-Reply-To: <877f3javde.fsf@intel.com> References: <20170320215713.3086140-1-arnd@arndb.de> <877f3javde.fsf@intel.com> From: Arnd Bergmann Date: Tue, 21 Mar 2017 09:44:07 +0100 X-Google-Sender-Auth: iCOJLwUI4vUCwc_l613_kM_hl-M Message-ID: Subject: Re: [PATCH] drm/i915: use static const array for PICK macro To: Jani Nikula Cc: Daniel Vetter , David Airlie , Mika Kuoppala , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Chris Wilson , Imre Deak , Ander Conselvan de Oliveira , Robert Bragg , intel-gfx@lists.freedesktop.org, dri-devel , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1144 Lines: 23 On Tue, Mar 21, 2017 at 9:26 AM, Jani Nikula wrote: > On Mon, 20 Mar 2017, Arnd Bergmann wrote: >> The varargs macro trick in _PIPE3/_PHY3/_PORT3 was meant as an optimization >> to shrink the i915 kernel module by around 1000 bytes. > > Really, I didn't care one bit about the size shrink, I only cared about > making it easier and less error prone to increase the number of args in > a number of places. Maintainability and correctness were the goals. Just > for the record. ;) Ok. My only interest here is the warning about possible stack overflow, though the fact that KASAN considers the array code to be fragile is an indication that it is perhaps actually dangerous: if we ever run into a bug that causes the array index to overflow, we might in theory have a security bug that lets users access arbitrary kernel pointers. While the risk for that actually happening is very low, the original code was safer in that regard. My patch on top of yours merely turns a hypothetical arbitrary stack access into an arbitrary .data access, and I don't even know which one would be worse. Arnd