* [PATCH] selftests/alsa: Fix format specifier and function mismatch in mixer-test
@ 2026-07-05 17:10 Malaya Kumar Rout
2026-07-06 8:24 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Malaya Kumar Rout @ 2026-07-05 17:10 UTC (permalink / raw)
To: linux-sound, tiwai
Cc: mrout, skhan, me, Malaya Kumar Rout, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Shuah Khan, linux-kselftest, linux-kernel
In the ctl_value_index_valid() function, when validating 64-bit integer
controls (SND_CTL_ELEM_TYPE_INTEGER64), the error message for maximum
value validation has two bugs:
1. Uses snd_ctl_elem_info_get_max() instead of the 64-bit variant
snd_ctl_elem_info_get_max64()
2. Uses %ld format specifier instead of %lld for long long type
This is inconsistent with the minimum value validation (line 335-339)
which correctly uses get_min64() and %lld. The mismatch can cause:
- Incorrect maximum values being reported on some architectures
- Undefined behavior due to format specifier mismatch
- Potential crashes when printing the error message
Fix by using snd_ctl_elem_info_get_max64() and %lld format specifier
to match the data type and be consistent with the minimum value check.
Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
---
tools/testing/selftests/alsa/mixer-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index d4f845c32804..242a0b21e85e 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -339,9 +339,9 @@ static bool ctl_value_index_valid(struct ctl_data *ctl,
}
if (int64_val > snd_ctl_elem_info_get_max64(ctl->info)) {
- ksft_print_msg("%s.%d value %lld more than maximum %ld\n",
+ ksft_print_msg("%s.%d value %lld more than maximum %lld\n",
ctl->name, index, int64_val,
- snd_ctl_elem_info_get_max(ctl->info));
+ snd_ctl_elem_info_get_max64(ctl->info));
return false;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/alsa: Fix format specifier and function mismatch in mixer-test
2026-07-05 17:10 [PATCH] selftests/alsa: Fix format specifier and function mismatch in mixer-test Malaya Kumar Rout
@ 2026-07-06 8:24 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-07-06 8:24 UTC (permalink / raw)
To: Malaya Kumar Rout
Cc: linux-sound, tiwai, mrout, skhan, me, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Shuah Khan, linux-kselftest, linux-kernel
On Sun, 05 Jul 2026 19:10:38 +0200,
Malaya Kumar Rout wrote:
>
> In the ctl_value_index_valid() function, when validating 64-bit integer
> controls (SND_CTL_ELEM_TYPE_INTEGER64), the error message for maximum
> value validation has two bugs:
>
> 1. Uses snd_ctl_elem_info_get_max() instead of the 64-bit variant
> snd_ctl_elem_info_get_max64()
> 2. Uses %ld format specifier instead of %lld for long long type
>
> This is inconsistent with the minimum value validation (line 335-339)
> which correctly uses get_min64() and %lld. The mismatch can cause:
> - Incorrect maximum values being reported on some architectures
> - Undefined behavior due to format specifier mismatch
> - Potential crashes when printing the error message
>
> Fix by using snd_ctl_elem_info_get_max64() and %lld format specifier
> to match the data type and be consistent with the minimum value check.
>
> Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
Thanks, applied now.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-06 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 17:10 [PATCH] selftests/alsa: Fix format specifier and function mismatch in mixer-test Malaya Kumar Rout
2026-07-06 8:24 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox