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 DE5FCC433EF for ; Thu, 14 Jul 2022 04:41:09 +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 250D31A9E; Thu, 14 Jul 2022 06:40:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 250D31A9E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657773668; bh=iE5yQa2DJlA8HOw9QQ5apeEo47lHRTArshMl4xWFAGI=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Hd5O4CvcGbM96OX4x/SJJrQtI9E7xWhXIW4e0UOVlqdmM6zVO0+UPjuaCnfM4aU5A Za4e/kKuOxOr6dAzWiHvnUtQCeClbP7lenRenXRGhq2jTfg8j6IFvxGPU9kE9d0wVA 3T3Anm14vjAity6EC9ZgumckJds5ZACd2q3mWCiU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EB403F805C8; Thu, 14 Jul 2022 06:27:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D12DAF805E1; Thu, 14 Jul 2022 06:27:14 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 43249F805C7 for ; Thu, 14 Jul 2022 06:27:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 43249F805C7 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kMuFYAGb" 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 D13BFB82333; Thu, 14 Jul 2022 04:27:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72259C3411C; Thu, 14 Jul 2022 04:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657772830; bh=iE5yQa2DJlA8HOw9QQ5apeEo47lHRTArshMl4xWFAGI=; h=From:To:Cc:Subject:Date:From; b=kMuFYAGbFPfW5H4Jg9m2bgovBuRotrdRroqC/XUZzW8U75j95hkrx3yvvxCLYysn3 jR9f99Q3oxjvXvpPWXDg+SCSaP9jH33rHmoeeg3UXOBrtta716yI/uaOiDVeuCyok+ Sh2Q7O2wAoW0vpkq/jaJcUaWpxrqqtg6QlKbZMiZwlkX39lHJmUD5rBrkGb4wraD+p Q1MxwIedGPdlGNuM0QhA70IKQiMTOMd80DSxksL4jfEwNogTI7KV8NnTcSjBilZzgo OPmvbN8yyXZAtwpU8sRWw2pXsq8dbX+bkF+no4VuRwMrLyyNaFSUOdrIodh689X5c2 DIrRyifqsnn/Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 1/4] ASoC: ops: Fix off by one in range control validation Date: Thu, 14 Jul 2022 00:27:04 -0400 Message-Id: <20220714042707.282675-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 90ba5521c189..4fda8c24be29 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -535,7 +535,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) @@ -556,7 +556,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 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C6AECCA47B for ; Thu, 14 Jul 2022 04:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237448AbiGNEij (ORCPT ); Thu, 14 Jul 2022 00:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbiGNEh6 (ORCPT ); Thu, 14 Jul 2022 00:37:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947B83DBFA; Wed, 13 Jul 2022 21:27:13 -0700 (PDT) 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 DF662B82372; Thu, 14 Jul 2022 04:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72259C3411C; Thu, 14 Jul 2022 04:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657772830; bh=iE5yQa2DJlA8HOw9QQ5apeEo47lHRTArshMl4xWFAGI=; h=From:To:Cc:Subject:Date:From; b=kMuFYAGbFPfW5H4Jg9m2bgovBuRotrdRroqC/XUZzW8U75j95hkrx3yvvxCLYysn3 jR9f99Q3oxjvXvpPWXDg+SCSaP9jH33rHmoeeg3UXOBrtta716yI/uaOiDVeuCyok+ Sh2Q7O2wAoW0vpkq/jaJcUaWpxrqqtg6QlKbZMiZwlkX39lHJmUD5rBrkGb4wraD+p Q1MxwIedGPdlGNuM0QhA70IKQiMTOMd80DSxksL4jfEwNogTI7KV8NnTcSjBilZzgo OPmvbN8yyXZAtwpU8sRWw2pXsq8dbX+bkF+no4VuRwMrLyyNaFSUOdrIodh689X5c2 DIrRyifqsnn/Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mark Brown , Sasha Levin , lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 4.9 1/4] ASoC: ops: Fix off by one in range control validation Date: Thu, 14 Jul 2022 00:27:04 -0400 Message-Id: <20220714042707.282675-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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 90ba5521c189..4fda8c24be29 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -535,7 +535,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) @@ -556,7 +556,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