diff options
author | Mark Brown <broonie@kernel.org> | 2022-06-04 11:52:46 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-21 20:42:47 +0200 |
commit | 2a0fcbf8ffb03e97be7ae0e393b09635cd15d823 (patch) | |
tree | e443cdf21f81137b72f0d77344655563f3742306 /sound/soc | |
parent | 9ec5a97f327a89031fce6cfc3e95543c53936638 (diff) | |
download | linux-stable-2a0fcbf8ffb03e97be7ae0e393b09635cd15d823.tar.gz linux-stable-2a0fcbf8ffb03e97be7ae0e393b09635cd15d823.tar.bz2 linux-stable-2a0fcbf8ffb03e97be7ae0e393b09635cd15d823.zip |
ASoC: ops: Fix off by one in range control validation
[ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ]
We currently report that range controls accept a range of 0..(max-min) but
accept writes in the range 0..(max-min+1). Remove that extra +1.
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-ops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 0848aec1bd24..81c9ecfa7c7f 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -535,7 +535,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; if (invert) @@ -556,7 +556,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, return -EINVAL; if (mc->platform_max && tmp > mc->platform_max) return -EINVAL; - if (tmp > mc->max - mc->min + 1) + if (tmp > mc->max - mc->min) return -EINVAL; if (invert) |