public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Tan Nayir <tannayir@gmail.com>
Cc: alsa-devel@alsa-project.org, stable@vger.kernel.org,
	Marek Vasut <marex@denx.de>
Subject: Re: [PATCH] ASoC: ops: Fix the bounds checking in snd_soc_put_volsw_sx and snd_soc_put_xr_sx
Date: Tue, 17 May 2022 14:04:42 +0100	[thread overview]
Message-ID: <YoOdauC5Q8POpHLe@sirena.org.uk> (raw)
In-Reply-To: <20220517011201.23530-1-tannayir@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On Tue, May 17, 2022 at 04:12:04AM +0300, Tan Nayir wrote:

> The $val in both functions has a range between 0 and an arbitrary limit
> whereas the range specified with the $min and $max can start
> from a negative number. To do the out of bound check correctly, the
> $val must be added the $min offset.

>  	val = ucontrol->value.integer.value[0];
> -	if (mc->platform_max && val > mc->platform_max)
> +	if (mc->platform_max && ((int)val + min) > mc->platform_max)

No, the minimum value we expose to userspace is always scaled so that
userspace sees a range starting from zero and that's where platform_max
is referenced to - we're applying this limit before we start remapping
to actual register values.  The code would be a lot simpler if we didn't
do this rescaling.

Please don't send new patches in reply to old patches or serieses, this
makes it harder for both people and tools to understand what is going
on - it can bury things in mailboxes and make it difficult to keep track
of what current patches are, both for the new patches and the old ones.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-05-17 13:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 13:06 [PATCH] ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min Marek Vasut
2022-02-16 18:01 ` Mark Brown
2022-02-23 14:55 ` Takashi Iwai
2022-02-23 16:32   ` Mark Brown
2022-02-23 16:44     ` Takashi Iwai
2022-02-23 16:52     ` Marek Vasut
2022-05-16 23:53       ` Tan N.
2022-05-17  1:12         ` [PATCH] ASoC: ops: Fix the bounds checking in snd_soc_put_volsw_sx and snd_soc_put_xr_sx Tan Nayir
2022-05-17 13:04           ` Mark Brown [this message]
2022-05-17 14:25             ` Tan Nayır
2022-05-17 18:20               ` Mark Brown
2022-05-17 19:58                 ` Tan Nayır
2022-05-18 12:07                   ` Mark Brown
2022-05-18 23:56                     ` Tan Nayır
2022-05-19 15:47                       ` Mark Brown

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=YoOdauC5Q8POpHLe@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=marex@denx.de \
    --cc=stable@vger.kernel.org \
    --cc=tannayir@gmail.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