Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4452605imw; Tue, 19 Jul 2022 06:56:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uyHOujK0q9LSXocnM5KjFCRsZZEeQKEDBJE9eWlu4q7SgVUd0GsRyZIK9/FBkvwf4IEG6M X-Received: by 2002:a17:907:7213:b0:72b:9ec4:9a63 with SMTP id dr19-20020a170907721300b0072b9ec49a63mr29348009ejc.399.1658238991967; Tue, 19 Jul 2022 06:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238991; cv=none; d=google.com; s=arc-20160816; b=kvL+nOxYt71QpnzwkX2DSjYZKwtVpA6g0obmjFIFijqO67EJtpjhs9VJIKTHH5ITiT cswNMHmEEj4yOeYtC/fwwSgvWMmw+2nbcfrnFCEwoXTXXdFPPaLjCXEFYFHFnb3ntX4f AKkoAybeEcp2emddvZgotFiMFI6TGiCFjM/lgCinRCTXwCFmYWWAoq8mRYzsUSi50j+I 7HQsBUnCuVJZl2mVzfoF63KcTVYRhxMnW7pC58/henIsuzvbXjcUO3oYGKrGyjNvWsZq B0CGZFbNdfBybU5hjherYcvGlYrhLFpNVHPsOvAzE3wGraqiqTURDRjqUyvZakBvfciJ Kt3Q== 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=hnn/FSfg2rnK7jb2RauB3s8s4tMHSZ1wDq90dMj/vFM=; b=PYrcHLZoPyHFCdSNiVmMKy/b/ZWImfjseLjBVGwPzshbJIcLgO2aDCwKR+yn+oqwua +Ya7oh8KMNbgfMfkcRnZU5+vBndghx9s7wBIGIviSgM7WEVuhBTHiNoNYhPqIf92XAXs feiKQNdYhCu3eLlXywkZXb0IVS0E4bfVoVc1IPKYRq0WgnRDSP6SFAsHxFeovUnNS5uV DjfJGPdb2PllRlX+i1Y+WOywjelF+38+SmBVosOiOIU63EuANkuJeoknM3xiWjJ35LGI vHRwOyTpWivftFFPhTqyVugn4xN03x5xIDYJXRiW3aKZsnxklUNLpEyfRUkW1pN0i4jp NqAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lHAyN0hd; 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 f32-20020a05640232a000b0043a45dcaf33si19429090eda.521.2022.07.19.06.56.06; Tue, 19 Jul 2022 06:56:31 -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=lHAyN0hd; 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 S243344AbiGSNKh (ORCPT + 99 others); Tue, 19 Jul 2022 09:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243304AbiGSNJP (ORCPT ); Tue, 19 Jul 2022 09:09:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D64151A19; Tue, 19 Jul 2022 05:28:25 -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 99021B81B32; Tue, 19 Jul 2022 12:28:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63E1C341DB; Tue, 19 Jul 2022 12:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233703; bh=+pwhI5DseAVUweaksDK2NMrC+e9Ib1UwCS+TtiDZy7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHAyN0hd0ojMNsJ6yYvwuCYHe73SjDmFPUcpYCVE2umVX2wrECZYogA2N7kil3kvo hkEX8Pwpvkzy3TvAUvZeKoa7oLTtdcX9jOAJ/HgMXsqw/mFo4Yh0xZfZUPyhOn3CHW yilGiNuC/KZS+Ekns+PECHYHlbL+Wujobfbb32mQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.18 183/231] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:28 +0200 Message-Id: <20220719114729.617862702@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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 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