[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130308162922.88ad40997d01099949008452@linux-foundation.org>
Date: Fri, 8 Mar 2013 16:29:22 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Christopher Li <sparse@...isli.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Linux-Sparse <linux-sparse@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: Suggestion for fixing the variable length array used in the
kernel.
On Wed, 6 Mar 2013 20:46:35 -0800 Christopher Li <sparse@...isli.org> wrote:
> Hi,
>
> I am looking at the current sparse warning on the kernel source.
> One category of those warning are produce by the variable length array.
> We all know that the kernel stack has a limit so we don't want to allocate
> too much stack to the variable size array.
>
> Is there a recommended way to fix those warnings? Is it worth while to
> fix it at all? I am looking forward to some kind of guideline how to handle
> this.
Roughly how many instances of this are there kernel-wide?
I don't think it's good practice in the kernel - it's somewhat
dangerous and the effects of errors will be catastrophic. And as
you've seen, those sites are difficult to review for safety.
We could just outright ban the thing and convert those sites to
kmalloc() or whatever. If people howl about the performance impact
(unlikely) then perhaps we can put something together using
__builtin_alloca() which includes runtime checking for "excessive"
allocations. If an excessive allocation is detected we'd warn and
return NULL.
Anyway, yes, variable-length arrays are problematic so for now, let's
leave the sparse warnings in place?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists