All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: ops: fix signedness bug in snd_soc_put_volsw()
@ 2022-01-28 11:20 ` Dan Carpenter
  0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2022-01-28 11:20 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: alsa-devel, kernel-janitors, linux-kernel, Takashi Iwai,
	Mark Brown

The "val" and "val2" variables need to signed for the checking to work
as intended.

Fixes: 817f7c9335ec ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/soc/soc-ops.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index dc0e7c8d31f3..0091fa96eb48 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -310,8 +310,9 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
 	unsigned int invert = mc->invert;
 	int err;
 	bool type_2r = false;
-	unsigned int val2 = 0;
-	unsigned int val, val_mask;
+	unsigned int val_mask;
+	int val2 = 0;
+	int val;
 
 	if (sign_bit)
 		mask = BIT(sign_bit + 1) - 1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-01-28 14:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 11:20 [PATCH 1/2] ASoC: ops: fix signedness bug in snd_soc_put_volsw() Dan Carpenter
2022-01-28 11:20 ` Dan Carpenter
2022-01-28 11:20 ` [PATCH 2/2] ASoC: ops: Fix signedness bug in snd_soc_put_volsw_sx() Dan Carpenter
2022-01-28 11:20   ` Dan Carpenter
2022-01-28 12:42 ` [PATCH 1/2] ASoC: ops: fix signedness bug in snd_soc_put_volsw() Mark Brown
2022-01-28 12:42   ` Mark Brown
2022-01-28 13:31   ` Dan Carpenter
2022-01-28 13:31     ` Dan Carpenter
2022-01-28 13:48     ` Mark Brown
2022-01-28 13:48       ` Mark Brown
2022-01-28 14:05       ` Dan Carpenter
2022-01-28 14:05         ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.