lkml.org 
[lkml]   [2022]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 183/231] ASoC: ops: Fix off by one in range control validation
    Date
    From: Mark Brown <broonie@kernel.org>

    [ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ]

    We currently report that range controls accept a range of 0..(max-min) but
    accept writes in the range 0..(max-min+1). Remove that extra +1.

    Signed-off-by: Mark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    sound/soc/soc-ops.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
    index e693070f51fe..d867f449d82d 100644
    --- a/sound/soc/soc-ops.c
    +++ b/sound/soc/soc-ops.c
    @@ -526,7 +526,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
    return -EINVAL;
    if (mc->platform_max && tmp > mc->platform_max)
    return -EINVAL;
    - if (tmp > mc->max - mc->min + 1)
    + if (tmp > mc->max - mc->min)
    return -EINVAL;

    if (invert)
    @@ -547,7 +547,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
    return -EINVAL;
    if (mc->platform_max && tmp > mc->platform_max)
    return -EINVAL;
    - if (tmp > mc->max - mc->min + 1)
    + if (tmp > mc->max - mc->min)
    return -EINVAL;

    if (invert)
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-07-19 15:11    [W:2.146 / U:1.284 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site