ALSA: kunit: make read-only array buf_samples static const
Subsystems (3)
PATCH 1/1 ALSA: kunit: make read-only array buf_samples static const
Don't populate the read-only array buf_samples on the stack at run time, instead make it static const.
--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/sound_kunit.c +1 -1
@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;
Signature · 1 line
2.39.2
Hi,
Quoted 13 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/sound_kunit.c +0
-0
sound/core/sound_kunit.c static void _test_fill_silence(struct kunit *test, struct snd_format_test_data * · line 172
Quoted 7 lines
sound/core/sound_kunit.c +1
-1@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;
We can see the other similar cases in the kunit file. I'll post the fix later.
Thanks
Takashi Sakamoto
Ivan Orlov
maintainerQuoted 26 lines · Takashi Sakamoto
Hi,
Quoted 13 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/sound_kunit.c +0
-0sound/core/sound_kunit.c static void _test_fill_silence(struct kunit *test, struct snd_format_test_data * · line 172
Quoted 7 lines
sound/core/sound_kunit.c +1
-1@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;Reviewed-by Takashi Sakamoto <[email protected]>
Quoted 3 lines
We can see the other similar cases in the kunit file. I'll post the fix later.
Hi Takashi,
Hmm, correct me if I'm wrong, but I don't see any other significant allocations on the stack in the test.
Signature · 2 lines
Kind regards, Ivan Orlov
Quoted 27 lines · Ivan Orlov
Quoted 25 lines · Takashi Sakamoto
Hi,
Quoted 13 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/sound_kunit.c +0
-0sound/core/sound_kunit.c static void _test_fill_silence(struct kunit *test, struct snd_format_test_data * · line 171
Quoted 6 lines
sound/core/sound_kunit.c +1
-1@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;Reviewed-by Takashi Sakamoto <[email protected]>
Quoted 8 lines
Quoted 3 lines
We can see the other similar cases in the kunit file. I'll post the fix later.
Hi Takashi,
Hmm, correct me if I'm wrong, but I don't see any other significant allocations on the stack in the test.
I guess he meant slightly different ones
https://lore.kernel.org/r/[email protected]
Takashi
Ivan Orlov
maintainerQuoted 33 lines · Takashi Iwai
Quoted 31 lines · Ivan Orlov
Quoted 28 lines · Takashi Sakamoto
Hi,
Quoted 13 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/sound_kunit.c +0
-0sound/core/sound_kunit.c static void _test_fill_silence(struct kunit *test, struct snd_format_test_data * · line 171
Quoted 6 lines
sound/core/sound_kunit.c +1
-1@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;Reviewed-by Takashi Sakamoto <[email protected]>We can see the other similar cases in the kunit file. I'll post the fix later.
Quoted 8 lines
Quoted 4 lines
Hi Takashi,
Hmm, correct me if I'm wrong, but I don't see any other significant allocations on the stack in the test.
I guess he meant slightly different ones
https://lore.kernel.org/r/[email protected]
Ah, alright, found it. Thank you!
Signature · 2 lines
Kind regards, Ivan Orlov
Quoted 13 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>--- sound/core/sound_kunit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/core/sound_kunit.c +0
-0
sound/core/sound_kunit.c static void _test_fill_silence(struct kunit *test, struct snd_format_test_data * · line 173
Quoted 8 lines
sound/core/sound_kunit.c +1
-1@@ -167,7 +167,7 @@ static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *static void test_format_fill_silence (struct kunit *test) { -u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES }; +static const u32 buf_samples[] = {10 ,20 ,32 ,64 ,129 ,SILENCE_BUFFER_MAX_FRAMES };u8 *buffer;u32 i, j;
Hi Colin,
Thank you for fixing this issue.
Signature · 2 lines
Kind regards, Ivan Orlov
Takashi Iwai
AppliedQuoted 5 lines · Colin Ian King
Don't populate the read-only array
buf_sampleson the stack at run time, instead make it static const.Signed-off-by Colin Ian King <[email protected]>
Thanks, applied now.
Takashi