From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: Re: [PATCH 2/9] drm/i915: [sparse] don't use variable size arrays Date: Tue, 17 Apr 2012 19:20:35 -0700 Message-ID: <20120417192035.5b3e58a4@bwidawsk.net> References: <1334610468-9274-1-git-send-email-ben@bwidawsk.net> <1334610468-9274-3-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 307269E74F for ; Tue, 17 Apr 2012 19:20:54 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Paulo Zanoni Cc: intel-gfx@lists.freedesktop.org, Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org On Tue, 17 Apr 2012 22:39:15 -0300 Paulo Zanoni wrote: > 2012/4/16 Ben Widawsky : > > Sparse doesn't like: > > "error: bad constant expression" > > > > > I know you'll hate me for asking, but: how difficult is it to fix sparse? > Adding those mallocs/frees increases the code complexity, making it > harder to read... > > I don't consider this a bikeshed. I've always been "under the impression" C99 was sort of taboo in the kernel. In this case specifically, it's never a great idea to allocate an unknown amount of stack space as it probably messes with some of the static tools and such. In other words, I believe the right thing to do here is not to fix sparse. Plus there is precedent in other drivers to fix this kind of thing for sparse. I originally had this patch create an arbitrarily large object on the stack and fail if the args_len was too big. I can go back to that certainly if people prefer.