From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54F4CC43334 for ; Thu, 14 Jul 2022 04:31:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 811C9188A; Thu, 14 Jul 2022 06:30:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 811C9188A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657773072; bh=08m7YkgMf00+tBrPAp/k1bxRwMkOC+fQBhyogyRaGSI=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=l7sFG7UVFUC8H7KlXHogTOeoiQwH2fB5aKYDFUN4085hUbfPE515mdSCrSmbEl3Jh Fca3sRJT8gS3rqwRgHreNjmakewijlAJJQ7fISPCH/PBci3b1fKsd206/9AkJhIxJZ eERKDJt5Oukna9DLJH4wAU8gEREyZ4hIjDXeyjvs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B6773F80549; Thu, 14 Jul 2022 06:24:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 739F6F80557; Thu, 14 Jul 2022 06:24:36 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1CFC3F80549 for ; Thu, 14 Jul 2022 06:24:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1CFC3F80549 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hFOC3vyF" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BB978B82379; Thu, 14 Jul 2022 04:24:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8458CC34114; Thu, 14 Jul 2022 04:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657772672; bh=08m7YkgMf00+tBrPAp/k1bxRwMkOC+fQBhyogyRaGSI=; h=From:To:Cc:Subject:Date:From; b=hFOC3vyFToJfJsLnbtKCjlvxmUTqSK1KLqbr8cm7BfaW1ZQ4vM5/R0TzJwdk7svnu DQknKSqLYADSXCuayqrEOX4hvf0JVIi2AOnJ4eS8e+8rzNEYGwAXP+E4v3tT7fi2t4 yQFi9VkuTz9jNrmAQmHXvrgCqONPRFMHdIM2jz81O3EhOnNjsnQxVm43asQA5jJCgE unqCcXvZNnETjINBzhGqNN7D3oJVVMFPnyjXnJtuAmbu3V9A8zAT9iQE1LlfZIIc2k YEAGkwbm6n6QQ02K01h8rQ0gpieKVURHM0hu5o2icn49Eu5IO9mj0FUQ1Y1x6f+BXR q6e3vJ76Bnnag== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 01/28] ASoC: ops: Fix off by one in range control validation Date: Thu, 14 Jul 2022 00:24:02 -0400 Message-Id: <20220714042429.281816-1-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Sasha Levin , alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com, Mark Brown X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Mark Brown [ 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 Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 f32ba64c5dda..e73360e9de8f 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