Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4373785imw; Tue, 19 Jul 2022 05:34:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbLrigfQUun5Y2XELsU6YgJ+7eAkecOwLBreyw+fivnL/dZLS3ZOWAwxQfiKDcl+kgfV3W X-Received: by 2002:a05:6402:2553:b0:43a:caa2:4956 with SMTP id l19-20020a056402255300b0043acaa24956mr42666241edb.406.1658234077345; Tue, 19 Jul 2022 05:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234077; cv=none; d=google.com; s=arc-20160816; b=G5lHoiFGg8BvO65MSSxCqbyFnU15O6PdsSCpujkgdtpgn9mNhONlZXmX+4OWAs0ski V9hJKi96ju1DsSrqkqAccvLpmXO+jphTjRRWP8KFjaHvNrtfioBVS3paEkLLNIsmPZss 4yrkbnmJeUW77iYG7oTap7O+AGrBgUKY707tvJitwp9Yh6OA1PB3ofev0I6lyFDVElND WjyvJzVfE2m3mddK0wL4n2syH3ms5jgmVpPNFkXXdy/h0qDA+EXgRkGZ4I56VbNVW9Bt TUBpCfDicpa1yGnSmKUqZTwLQoygkqDdddTVvnxDfv7V0r9pF8Munkb7vmgMOHxJa6+k FgCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vuLCYlgfZ6N49V8wthm0dZDtDJ79GFdt+RlHftufpFA=; b=bJ5tBMh/r65xSXvXCQ/mtMgWdIvoxJUIp1gLry3nZ96LqZ9P0EWdTaQU58aRjkm50v mQJzvoB8iStt6yhIaMJUONUw87FJb2X7wypav9oOXP3q8XNEpTR2HlSCPmbkBVfZac2l GtPr5YsFxaJVU0fMijlCSN9URbQO2r9mxHfqRD7kdZbkRPR4sthriWphb6QVSDq4eJHN w+spIwp1kfTIO2OjiO/NHNPuNOymDs6LR4SgAFmXCYWiSgAIoukobGES8RfNV+Y1SHjn mhKkYqh1paN8QSCIaqWvzH+vH054Y31JWMxymX2dXsXyUAlefwRGKr8NZisWiY9rxhwq SNUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VuVgFT7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z101-20020a509e6e000000b0043a0f0772d4si2637230ede.262.2022.07.19.05.34.10; Tue, 19 Jul 2022 05:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VuVgFT7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238268AbiGSMIO (ORCPT + 99 others); Tue, 19 Jul 2022 08:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238231AbiGSMHn (ORCPT ); Tue, 19 Jul 2022 08:07:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28B1245F40; Tue, 19 Jul 2022 05:01:21 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1B1EC61632; Tue, 19 Jul 2022 12:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDD3AC341C6; Tue, 19 Jul 2022 12:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232078; bh=XqlTd4nTiZWMDUpAlCHbBSebnj0dDtBFRM1zS2k8yng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuVgFT7SJbojnGsZr1S9aMJ6/KBT8XZ41uQySwHRvBr2XwkrsosQAFJmI6cxryAeM OAOZm7hgIEPVPe2Y7gn6Z9iTUwLDvcifyi8Y/vdlOVXy1j0DxUcjhDaQ7BwqojL25e yUCTLos6KEbSzXoqxi7eUZ6R12Ht+NBSfad3iDkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 4.19 35/48] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:12 +0200 Message-Id: <20220719114522.983985285@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114518.915546280@linuxfoundation.org> References: <20220719114518.915546280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 7a37312c8e0c..453b61b42dd9 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -530,7 +530,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) @@ -551,7 +551,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