[Intel-gfx] [PATCH 2/9] drm/i915: [sparse] don't use variable size arrays
ben at bwidawsk.net
Wed Apr 18 04:20:35 CEST 2012
On Tue, 17 Apr 2012 22:39:15 -0300
Paulo Zanoni <przanoni at gmail.com> wrote:
> 2012/4/16 Ben Widawsky <ben at bwidawsk.net>:
> > 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
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.
More information about the Intel-gfx