On Wed, 6 Mar 2013 20:46:35 -0800 Christopher Li <sparse@xxxxxxxxxxx> 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-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html