* [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
@ 2024-04-25 16:07 Colin Ian King
2024-04-25 23:22 ` Takashi Sakamoto
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Colin Ian King @ 2024-04-25 16:07 UTC (permalink / raw
To: Ivan Orlov, Jaroslav Kysela, Takashi Iwai, linux-sound
Cc: kernel-janitors, linux-kernel
Don't populate the read-only array buf_samples on the stack at
run time, instead make it static const.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
sound/core/sound_kunit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
index eb90f62228c0..e34c4317f5eb 100644
--- a/sound/core/sound_kunit.c
+++ b/sound/core/sound_kunit.c
@@ -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;
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-25 16:07 [PATCH][next] ALSA: kunit: make read-only array buf_samples static const Colin Ian King
@ 2024-04-25 23:22 ` Takashi Sakamoto
2024-04-26 12:05 ` Ivan Orlov
2024-04-26 10:23 ` Ivan Orlov
2024-04-26 15:07 ` Takashi Iwai
2 siblings, 1 reply; 7+ messages in thread
From: Takashi Sakamoto @ 2024-04-25 23:22 UTC (permalink / raw
To: Colin Ian King
Cc: Ivan Orlov, Jaroslav Kysela, Takashi Iwai, linux-sound,
kernel-janitors, linux-kernel
Hi,
On Thu, Apr 25, 2024 at 05:07:54PM +0100, Colin Ian King wrote:
> Don't populate the read-only array buf_samples on the stack at
> run time, instead make it static const.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> sound/core/sound_kunit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
> index eb90f62228c0..e34c4317f5eb 100644
> --- a/sound/core/sound_kunit.c
> +++ b/sound/core/sound_kunit.c
> @@ -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 <o-takashi@sakamocchi.jp>
We can see the other similar cases in the kunit file. I'll post the fix
later.
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-25 16:07 [PATCH][next] ALSA: kunit: make read-only array buf_samples static const Colin Ian King
2024-04-25 23:22 ` Takashi Sakamoto
@ 2024-04-26 10:23 ` Ivan Orlov
2024-04-26 15:07 ` Takashi Iwai
2 siblings, 0 replies; 7+ messages in thread
From: Ivan Orlov @ 2024-04-26 10:23 UTC (permalink / raw
To: Colin Ian King, Jaroslav Kysela, Takashi Iwai, linux-sound
Cc: kernel-janitors, linux-kernel
On 4/25/24 17:07, Colin Ian King wrote:
> Don't populate the read-only array buf_samples on the stack at
> run time, instead make it static const.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> sound/core/sound_kunit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
> index eb90f62228c0..e34c4317f5eb 100644
> --- a/sound/core/sound_kunit.c
> +++ b/sound/core/sound_kunit.c
> @@ -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.
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
--
Kind regards,
Ivan Orlov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-25 23:22 ` Takashi Sakamoto
@ 2024-04-26 12:05 ` Ivan Orlov
2024-04-26 15:08 ` Takashi Iwai
0 siblings, 1 reply; 7+ messages in thread
From: Ivan Orlov @ 2024-04-26 12:05 UTC (permalink / raw
To: Takashi Sakamoto, Colin Ian King, Jaroslav Kysela, Takashi Iwai,
linux-sound, kernel-janitors, linux-kernel
On 4/26/24 00:22, Takashi Sakamoto wrote:
> Hi,
>
> On Thu, Apr 25, 2024 at 05:07:54PM +0100, Colin Ian King wrote:
>> Don't populate the read-only array buf_samples on the stack at
>> run time, instead make it static const.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>> sound/core/sound_kunit.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
>> index eb90f62228c0..e34c4317f5eb 100644
>> --- a/sound/core/sound_kunit.c
>> +++ b/sound/core/sound_kunit.c
>> @@ -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 <o-takashi@sakamocchi.jp>
>
> 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.
--
Kind regards,
Ivan Orlov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-25 16:07 [PATCH][next] ALSA: kunit: make read-only array buf_samples static const Colin Ian King
2024-04-25 23:22 ` Takashi Sakamoto
2024-04-26 10:23 ` Ivan Orlov
@ 2024-04-26 15:07 ` Takashi Iwai
2 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2024-04-26 15:07 UTC (permalink / raw
To: Colin Ian King
Cc: Ivan Orlov, Jaroslav Kysela, Takashi Iwai, linux-sound,
kernel-janitors, linux-kernel
On Thu, 25 Apr 2024 18:07:54 +0200,
Colin Ian King wrote:
>
> Don't populate the read-only array buf_samples on the stack at
> run time, instead make it static const.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Thanks, applied now.
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-26 12:05 ` Ivan Orlov
@ 2024-04-26 15:08 ` Takashi Iwai
2024-04-26 23:22 ` Ivan Orlov
0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2024-04-26 15:08 UTC (permalink / raw
To: Ivan Orlov
Cc: Takashi Sakamoto, Colin Ian King, Jaroslav Kysela, Takashi Iwai,
linux-sound, kernel-janitors, linux-kernel
On Fri, 26 Apr 2024 14:05:34 +0200,
Ivan Orlov wrote:
>
> On 4/26/24 00:22, Takashi Sakamoto wrote:
> > Hi,
> >
> > On Thu, Apr 25, 2024 at 05:07:54PM +0100, Colin Ian King wrote:
> >> Don't populate the read-only array buf_samples on the stack at
> >> run time, instead make it static const.
> >>
> >> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> >> ---
> >> sound/core/sound_kunit.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
> >> index eb90f62228c0..e34c4317f5eb 100644
> >> --- a/sound/core/sound_kunit.c
> >> +++ b/sound/core/sound_kunit.c
> >> @@ -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 <o-takashi@sakamocchi.jp>
> >
> > 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/20240425233653.218434-1-o-takashi@sakamocchi.jp
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][next] ALSA: kunit: make read-only array buf_samples static const
2024-04-26 15:08 ` Takashi Iwai
@ 2024-04-26 23:22 ` Ivan Orlov
0 siblings, 0 replies; 7+ messages in thread
From: Ivan Orlov @ 2024-04-26 23:22 UTC (permalink / raw
To: Takashi Iwai
Cc: Takashi Sakamoto, Colin Ian King, Jaroslav Kysela, Takashi Iwai,
linux-sound, kernel-janitors, linux-kernel
On 4/26/24 16:08, Takashi Iwai wrote:
> On Fri, 26 Apr 2024 14:05:34 +0200,
> Ivan Orlov wrote:
>>
>> On 4/26/24 00:22, Takashi Sakamoto wrote:
>>> Hi,
>>>
>>> On Thu, Apr 25, 2024 at 05:07:54PM +0100, Colin Ian King wrote:
>>>> Don't populate the read-only array buf_samples on the stack at
>>>> run time, instead make it static const.
>>>>
>>>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>>>> ---
>>>> sound/core/sound_kunit.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
>>>> index eb90f62228c0..e34c4317f5eb 100644
>>>> --- a/sound/core/sound_kunit.c
>>>> +++ b/sound/core/sound_kunit.c
>>>> @@ -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 <o-takashi@sakamocchi.jp>
>>>
>>> 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/20240425233653.218434-1-o-takashi@sakamocchi.jp
>
Ah, alright, found it. Thank you!
--
Kind regards,
Ivan Orlov
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-26 23:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 16:07 [PATCH][next] ALSA: kunit: make read-only array buf_samples static const Colin Ian King
2024-04-25 23:22 ` Takashi Sakamoto
2024-04-26 12:05 ` Ivan Orlov
2024-04-26 15:08 ` Takashi Iwai
2024-04-26 23:22 ` Ivan Orlov
2024-04-26 10:23 ` Ivan Orlov
2024-04-26 15:07 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).