summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-05-11 14:41:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-08 11:18:34 +0100
commit46bab25cc0230df60d1c02b651cc5640a14b08df (patch)
tree7dcc2be0a6453f5a11e6d8ca825f851529f69c82 /sound
parent18de69177662ac0c945f5a97bea9840418a7d9a8 (diff)
downloadlinux-stable-46bab25cc0230df60d1c02b651cc5640a14b08df.tar.gz
linux-stable-46bab25cc0230df60d1c02b651cc5640a14b08df.tar.bz2
linux-stable-46bab25cc0230df60d1c02b651cc5640a14b08df.zip
ASoC: ops: Fix bounds check for _sx controls
[ Upstream commit 698813ba8c580efb356ace8dbf55f61dac6063a8 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 453b61b42dd9..2faf95d4bb75 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -445,7 +445,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;
if (val < 0)
return -EINVAL;