Re: [PATCH] [v2] firmware: cs_dsp: avoid large local variables

From: Richard Fitzgerald
Date: Mon Dec 16 2024 - 07:40:00 EST


On 16/12/2024 12:15 pm, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

Having 1280 bytes of local variables on the stack exceeds the limit
on 32-bit architectures:

drivers/firmware/cirrus/test/cs_dsp_test_bin.c: In function 'bin_patch_mixed_packed_unpacked_random':
drivers/firmware/cirrus/test/cs_dsp_test_bin.c:2097:1: error: the frame size of 1784 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Use dynamic allocation for the largest two here.

Fixes: dd0b6b1f29b9 ("firmware: cs_dsp: Add KUnit testing of bin file download")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
v2 changes:
- use kunit_kmalloc() as suggested by Richard Fitzgerald
- use KUNIT_ASSERT_NOT_NULL
---
.../firmware/cirrus/test/cs_dsp_test_bin.c | 33 +++++++++++--------
1 file changed, 19 insertions(+), 14 deletions(-)

Reviewed-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>

Thanks for doing this.