Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4439963imw; Tue, 19 Jul 2022 06:41:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sRvDFZ1sUEzU0yIC8e4UV2Urq5sfTQuIPSagueFsK+vIPz9WBBLwSTMJAWZuyVS7B4u0AB X-Received: by 2002:a17:906:9b14:b0:72b:313b:2df4 with SMTP id eo20-20020a1709069b1400b0072b313b2df4mr30792010ejc.99.1658238103891; Tue, 19 Jul 2022 06:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238103; cv=none; d=google.com; s=arc-20160816; b=yKDl/z+vPeciyTptl2Xhjuck+Mvf26KjAzrUKYH+4k/XFgPPQbJf6+d2rEUa+ROzm+ NtYsjC5DUeOoqmFFjPUNSmI1qYpgbLJD5cSYQMaPCJj0VZkKkknLR5kR1KfLwJn3cFuf NyCCHxfDng6UZL32F9JjPbKVm5HHsoCZyZGU8FaxtKZxjwbTSe/+cZVoR1vf7phDQaWA x0asKTGP46MRxz1ZfI7ng5evpQpi0QeYdIo6qc4FADrvqjNGG3qL0qo3Z/xNPfNoomg+ rEpN9SDYwXgxU/fiY1MLincCFTLLjOPmRvnNvuG59aOCrvMoVeZqP0mrsNZjnTcD9v5b 9/vQ== 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=AVtrAD1+mgH7AaY5PP/v9ElLt1quwzhuEF2lZtkWj9w=; b=GEEv6v+6vnomkIMorf8/uNKsfav/RejWEyOEdLqhmKdDJG5E2pBObc81bMFVTFWcz/ gD1ftSTQTNnnq35QYryJ4rapB6ikSH7kWy41eMrxj4HumPNtJFs9O3EIOWIk2Q+XAuSh KBtDu50I5x3peYwyiIUK7d8h7UaMmVkX4oHps9m+l0br0uYrnWI2hc8y6gZyvj0KjwUP 5NAgWRxoQEDd92mGNiTqbTs/2R8I1WxEe6jZhyDbpTLyjtuvUsVmBSmjTmLAnAZMBCqH yyMg9d0uEtHo72LJaA1QM7FHx72i35u24gPwgDP2YvCSa6Huv61m4mLPtQEIZt7M2sib 2u4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pvon8KX0; 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 t17-20020aa7d711000000b0043adae91e5csi16947692edq.611.2022.07.19.06.41.19; Tue, 19 Jul 2022 06:41:43 -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=pvon8KX0; 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 S239777AbiGSM0N (ORCPT + 99 others); Tue, 19 Jul 2022 08:26:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240163AbiGSMYl (ORCPT ); Tue, 19 Jul 2022 08:24:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF9045F6A; Tue, 19 Jul 2022 05:09:30 -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 DC36FB81B31; Tue, 19 Jul 2022 12:08:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 498ADC341C6; Tue, 19 Jul 2022 12:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232530; bh=fw9XhsSsHJOAoHA7IJQfgjSpPMbNwTc5hGVW6cBOafc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvon8KX0lVCz3sF/OdJjQ586v67kSV8wpUqIUVXRuifvIhPzT00xJv/vHrqYplBJK N5mP/H3w9fYdAFa0SLdr6IlHPjPsEfEAFOAdXXvkgbfH4yeB3VLQCG1kaNIIhqlIyK VKfR5HwDZpX0u9ADSh7h4eE0hK4ivmCmF3HjWIGw= 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.10 088/112] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:54:21 +0200 Message-Id: <20220719114635.207107925@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 15bfcdbdfaa4..0f26d6c31ce5 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -517,7 +517,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) @@ -538,7 +538,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