Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls
@ 2022-05-11 13:41 Mark Brown
  2022-05-11 13:41 ` [PATCH 2/2] ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx() Mark Brown
  2022-05-12 14:12 ` [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2022-05-11 13:41 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown

For _sx controls the semantics of the max field is not the usual one, max
is the number of steps rather than the maximum value. This means that our
check in snd_soc_put_volsw_sx() needs to just check against the maximum
value.

Fixes: 4f1e50d6a9cf9c1b ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx()")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index e693070f51fe..1ac7e2ce31a1 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -435,7 +435,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 	val = ucontrol->value.integer.value[0];
 	if (mc->platform_max && val > mc->platform_max)
 		return -EINVAL;
-	if (val > max - min)
+	if (val > max)
 		return -EINVAL;
 	val_mask = mask << shift;
 	val = (val + min) & mask;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 0/2] SX control bounds check fixups
@ 2022-11-25 15:48 Charles Keepax
  2022-11-25 15:48 ` [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls Charles Keepax
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2022-11-25 15:48 UTC (permalink / raw)
  To: broonie; +Cc: patches, alsa-devel, guille.rodriguez, lgirdwood

These two SX control fixups seem to have got lost somewhere along the
line. They were merged back in 5.18 but never seems to actually make it
into the kernel:

https://lore.kernel.org/all/165236477046.1016627.15470197691244479154.b4-ty@kernel.org/

Apologies if resending isn't the correct course but it seemed the safest
way to go. Note I have made a slight fixup to the second patch.

Thanks,
Charles

Mark Brown (2):
  ASoC: ops: Fix bounds check for _sx controls
  ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()

 sound/soc/soc-ops.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2022-11-25 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-11 13:41 [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls Mark Brown
2022-05-11 13:41 ` [PATCH 2/2] ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx() Mark Brown
2022-05-12 14:12 ` [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2022-11-25 15:48 [PATCH 0/2] SX control bounds check fixups Charles Keepax
2022-11-25 15:48 ` [PATCH 1/2] ASoC: ops: Fix bounds check for _sx controls Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox