From 51f779e15ab84be79f468b4b8a6a4faaf4e01197 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Sat, 20 May 2023 17:48:36 +0300 Subject: [PATCH] Revert "ASoC: ops: Fix the bounds checking in snd_soc_put_volsw_sx and snd_soc_put_xr_sx" This is now properly fixed in 1d2326b3a1380844d7899dec4929ff37e3a41a1e. This reverts commit 6d6a178f582a801b7e15bec1b61cc7816b35d9d0. Change-Id: I12e26bc35c4d7e0f87ff024a7073638c915fec4a --- sound/soc/soc-ops.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 7b5e20789ba2..28ceddeb1475 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -449,7 +449,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, unsigned int val, val_mask, val2 = 0; val = ucontrol->value.integer.value[0]; - if (mc->platform_max && ((int)val + min) > mc->platform_max) + if (mc->platform_max && val > mc->platform_max) return -EINVAL; if (val > max) return -EINVAL; @@ -946,12 +946,11 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, unsigned int invert = mc->invert; unsigned long mask = (1UL<nbits)-1; long max = mc->max; - long min = mc->min; long val = ucontrol->value.integer.value[0]; unsigned int i, regval, regmask; int err; - if (val < mc->min || ((int)val + min) > mc->max) + if (val < mc->min || val > mc->max) return -EINVAL; if (invert) val = max - val;