Suggestion for fixing the variable length array used in the kernel.

2013-03-06 Thread Christopher Li
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 thos

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-08 Thread Dan Carpenter
On Fri, Mar 08, 2013 at 04:29:22PM -0800, Andrew Morton wrote: > On Wed, 6 Mar 2013 20:46:35 -0800 Christopher Li 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

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-09 Thread Christopher Li
On Fri, Mar 8, 2013 at 9:39 PM, Dan Carpenter wrote: > On Fri, Mar 08, 2013 at 04:29:22PM -0800, Andrew Morton wrote: >> Roughly how many instances of this are there kernel-wide? >> > > Around 150 on x86 allmodconfig. They are pretty well audited. I saw 207 on x86-64 allmodconfig. See the list t

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-09 Thread Dan Carpenter
On Sat, Mar 09, 2013 at 10:10:08AM -0800, Christopher Li wrote: > On Fri, Mar 8, 2013 at 9:39 PM, Dan Carpenter > wrote: > > On Fri, Mar 08, 2013 at 04:29:22PM -0800, Andrew Morton wrote: > >> Roughly how many instances of this are there kernel-wide? > >> > > > > Around 150 on x86 allmodconfig.

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-09 Thread Christopher Li
On Sat, Mar 9, 2013 at 2:34 PM, Dan Carpenter wrote: > The problems is if we go over the 8k stack. So big arrays are bad. > Also if the dynamically sized array is inside a loop then normally > GCC frees it after each iteration, but on some arches it didn't free > it until after the last iteration

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-10 Thread Dan Carpenter
On Sat, Mar 09, 2013 at 03:00:54PM -0800, Christopher Li wrote: > On Sat, Mar 9, 2013 at 2:34 PM, Dan Carpenter > wrote: > > The problems is if we go over the 8k stack. So big arrays are bad. > > Also if the dynamically sized array is inside a loop then normally > > GCC frees it after each itera

Re: Suggestion for fixing the variable length array used in the kernel.

2013-03-08 Thread Andrew Morton
On Wed, 6 Mar 2013 20:46:35 -0800 Christopher Li 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 sta