diff mbox series

[2/2] ASoC: ops: Fix signedness bug in snd_soc_put_volsw_sx()

Message ID 20220128112042.GB24806@kili
State New
Headers show
Series [1/2] ASoC: ops: fix signedness bug in snd_soc_put_volsw() | expand

Commit Message

Dan Carpenter Jan. 28, 2022, 11:20 a.m. UTC
The "val" variable needs to be signed for the checking to work
correctly.

Fixes: 4f1e50d6a9cf ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/soc/soc-ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 0091fa96eb48..a615316a06ff 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -422,7 +422,8 @@  int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 	int min = mc->min;
 	unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
 	int err = 0;
-	unsigned int val, val_mask;
+	unsigned int val_mask;
+	int val;
 
 	val = ucontrol->value.integer.value[0];
 	if (mc->platform_max && val > mc->platform_max)