Skip to content

Commit 698813b

Browse files
committed
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: 4f1e50d ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx()") Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b776c4a commit 698813b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/soc-ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
435435
val = ucontrol->value.integer.value[0];
436436
if (mc->platform_max && val > mc->platform_max)
437437
return -EINVAL;
438-
if (val > max - min)
438+
if (val > max)
439439
return -EINVAL;
440440
val_mask = mask << shift;
441441
val = (val + min) & mask;

0 commit comments

Comments
 (0)