Skip to content

Commit 5ef4c30

Browse files
committed
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 169b5448ff79506525d14e4ee53ebfcc347bb61c. This reverts commit f2afdeb. Change-Id: I12e26bc35c4d7e0f87ff024a7073638c915fec4a
1 parent 0c32f0a commit 5ef4c30

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

sound/soc/soc-ops.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
449449
unsigned int val, val_mask, val2 = 0;
450450

451451
val = ucontrol->value.integer.value[0];
452-
if (mc->platform_max && ((int)val + min) > mc->platform_max)
452+
if (mc->platform_max && val > mc->platform_max)
453453
return -EINVAL;
454454
if (val > max)
455455
return -EINVAL;
@@ -946,12 +946,11 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
946946
unsigned int invert = mc->invert;
947947
unsigned long mask = (1UL<<mc->nbits)-1;
948948
long max = mc->max;
949-
long min = mc->min;
950949
long val = ucontrol->value.integer.value[0];
951950
unsigned int i, regval, regmask;
952951
int err;
953952

954-
if (val < mc->min || ((int)val + min) > mc->max)
953+
if (val < mc->min || val > mc->max)
955954
return -EINVAL;
956955
if (invert)
957956
val = max - val;

0 commit comments

Comments
 (0)