diff options
author | Mark Brown <broonie@kernel.org> | 2022-05-11 15:41:36 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-05-12 12:41:21 +0200 |
commit | 698813ba8c580efb356ace8dbf55f61dac6063a8 (patch) | |
tree | 53ec341920244209927d096bfc918ee949d529a4 /sound | |
parent | ASoC: fsl_micfil: explicitly clear CHnF flags (diff) | |
download | linux-698813ba8c580efb356ace8dbf55f61dac6063a8.tar.xz linux-698813ba8c580efb356ace8dbf55f61dac6063a8.zip |
ASoC: ops: Fix bounds check for _sx controls
For _sx controls the semantics of the max field is not the usual one, max
is the number of steps rather than the maximum value. This means that our
check in snd_soc_put_volsw_sx() needs to just check against the maximum
value.
Fixes: 4f1e50d6a9cf9c1b ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx()")
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220511134137.169575-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-ops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index e693070f51fe..1ac7e2ce31a1 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -435,7 +435,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, val = ucontrol->value.integer.value[0]; if (mc->platform_max && val > mc->platform_max) return -EINVAL; - if (val > max - min) + if (val > max) return -EINVAL; val_mask = mask << shift; val = (val + min) & mask; |