Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	Takashi Iwai <tiwai@suse.com>
Subject: [PATCH 2/2] ASoC: ops: Fix signedness bug in snd_soc_put_volsw_sx()
Date: Fri, 28 Jan 2022 14:20:42 +0300	[thread overview]
Message-ID: <20220128112042.GB24806@kili> (raw)
In-Reply-To: <20220128112007.GA24806@kili>

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 --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)
-- 
2.20.1


  reply	other threads:[~2022-01-28 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-01-28 12:42 ` Mark Brown
2022-01-28 13:31   ` Dan Carpenter
2022-01-28 13:48     ` Mark Brown
2022-01-28 14:05       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128112042.GB24806@kili \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox