Re: [PATCH v2] staging: vchiq_arm: Clear VLA warning

2018-03-12 Thread Dan Carpenter
On Mon, Mar 12, 2018 at 06:58:04AM +0100, Stefan Wahren wrote:
> Hi Tobin,
> 
> > "Tobin C. Harding"  hat am 12. März 2018 um 06:46 
> > geschrieben:
> > 
> > 
> > On Mon, Mar 12, 2018 at 12:37:53PM +1100, Tobin C. Harding wrote:
> > > The kernel would like to have all stack VLA usage removed[1].  The array
> > > here is fixed (declared with a const variable) but it appears like a VLA
> > > to the compiler.  Also, currently we are putting 768 bytes on the
> > > stack.  This function is only called on the error path so performance is
> > > not critical, let's just allocate the memory instead of using the
> > > stack.  This saves stack space and removes the VLA build warning.
> > > 
> > > kmalloc a buffer for dumping state instead of using the stack.
> > > 
> > > [1]: https://lkml.org/lkml/2018/3/7/621
> > > 
> > > Signed-off-by: Tobin C. Harding 
> > > ---
> > 
> > Drop this please, leaks memory.
> 
> except from the leak, did you test this patch on a RPi?
> 

Hm...  Yeah.  It looks like we're holding a mutex when we call
vchiq_check_service() from vchiq_queue_message().

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: vchiq_arm: Clear VLA warning

2018-03-12 Thread Tobin C. Harding
On Mon, Mar 12, 2018 at 06:58:04AM +0100, Stefan Wahren wrote:
> Hi Tobin,
> 
> > "Tobin C. Harding"  hat am 12. März 2018 um 06:46 
> > geschrieben:
> > 
> > 
> > On Mon, Mar 12, 2018 at 12:37:53PM +1100, Tobin C. Harding wrote:
> > > The kernel would like to have all stack VLA usage removed[1].  The array
> > > here is fixed (declared with a const variable) but it appears like a VLA
> > > to the compiler.  Also, currently we are putting 768 bytes on the
> > > stack.  This function is only called on the error path so performance is
> > > not critical, let's just allocate the memory instead of using the
> > > stack.  This saves stack space and removes the VLA build warning.
> > > 
> > > kmalloc a buffer for dumping state instead of using the stack.
> > > 
> > > [1]: https://lkml.org/lkml/2018/3/7/621
> > > 
> > > Signed-off-by: Tobin C. Harding 
> > > ---
> > 
> > Drop this please, leaks memory.
> 
> except from the leak, did you test this patch on a RPi?

No I didn't, but I can have a go at it.  Will try before doing v3.

thanks,
Tobin.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: vchiq_arm: Clear VLA warning

2018-03-11 Thread Stefan Wahren
Hi Tobin,

> "Tobin C. Harding"  hat am 12. März 2018 um 06:46 geschrieben:
> 
> 
> On Mon, Mar 12, 2018 at 12:37:53PM +1100, Tobin C. Harding wrote:
> > The kernel would like to have all stack VLA usage removed[1].  The array
> > here is fixed (declared with a const variable) but it appears like a VLA
> > to the compiler.  Also, currently we are putting 768 bytes on the
> > stack.  This function is only called on the error path so performance is
> > not critical, let's just allocate the memory instead of using the
> > stack.  This saves stack space and removes the VLA build warning.
> > 
> > kmalloc a buffer for dumping state instead of using the stack.
> > 
> > [1]: https://lkml.org/lkml/2018/3/7/621
> > 
> > Signed-off-by: Tobin C. Harding 
> > ---
> 
> Drop this please, leaks memory.

except from the leak, did you test this patch on a RPi?

Thanks
Stefan

> 
> thanks,
> Tobin.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: vchiq_arm: Clear VLA warning

2018-03-11 Thread Tobin C. Harding
On Mon, Mar 12, 2018 at 12:37:53PM +1100, Tobin C. Harding wrote:
> The kernel would like to have all stack VLA usage removed[1].  The array
> here is fixed (declared with a const variable) but it appears like a VLA
> to the compiler.  Also, currently we are putting 768 bytes on the
> stack.  This function is only called on the error path so performance is
> not critical, let's just allocate the memory instead of using the
> stack.  This saves stack space and removes the VLA build warning.
> 
> kmalloc a buffer for dumping state instead of using the stack.
> 
> [1]: https://lkml.org/lkml/2018/3/7/621
> 
> Signed-off-by: Tobin C. Harding 
> ---

Drop this please, leaks memory.

thanks,
Tobin.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel