diff options
| author | Malaya Kumar Rout <malayarout91@gmail.com> | 2026-07-05 22:40:38 +0530 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-07-06 10:24:05 +0200 |
| commit | c845febafd92b2056abc0af541c1ad85785f1353 (patch) | |
| tree | 3ae802a63129c6d91d34298232fc73abbf6f3588 /tools/testing/selftests | |
| parent | ea588e4c7484ea883d3dab308f1f2c2f0f51f7d6 (diff) | |
| download | linux-next-c845febafd92b2056abc0af541c1ad85785f1353.tar.gz linux-next-c845febafd92b2056abc0af541c1ad85785f1353.zip | |
selftests/alsa: Fix format specifier and function mismatch in mixer-test
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>
Link: https://patch.msgid.link/20260705171038.171966-1-malayarout91@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'tools/testing/selftests')
| -rw-r--r-- | tools/testing/selftests/alsa/mixer-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index c5ae2a026ce9..a329f901c5ed 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -340,9 +340,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; } |
