Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4370925imw; Tue, 19 Jul 2022 05:31:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ufsgphQFLS87aV1cxOpG/0Y+ABo7YoqA1d4HGyjGfViFYspjUkLFE71s2xuII9t+XI3HO9 X-Received: by 2002:a05:6402:26d5:b0:43a:bf2a:c27b with SMTP id x21-20020a05640226d500b0043abf2ac27bmr44044592edd.61.1658233893154; Tue, 19 Jul 2022 05:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233893; cv=none; d=google.com; s=arc-20160816; b=WEPXNIPRKlKBE73WdBsi7Qz2uMXs1IKZ4jTixt3PWlxKLXPYWEEUiEULu8Z9LPHoaD nqVrGjfOq+UKs7Ls19mH31a2mk99flz8NpDv1EKRNPyA7nyVCU7uqkcMQ/IPY9NHWvjt bcCXTIheRxZnWjiTxzTErGAEBHFkjCaNkj/izsBo6UKH5OIZ208v5V38E//9ixzzsdT1 Yqz4dhEzQNw3pRjJyeUMkvrehc/rgeK7e4rAb6mQDM9U1HXGM/BuUnPMCq5ArPJeo+h4 4JyGWCYA0a0XnFOGG8N1D/GksyqgBQxHUeANUNF/VopdMjylwx7tTe8B/xVhn7lMGnA4 4RvA== 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=FYXU6HU11dsNw5oJOaLFtMxTI6cCp70WbO0I/aeLhJQ=; b=QWSDq5a+/5W9QGhqGR1vuz4rq7Vqdq3Mee+f/RyuB6QMbRKBYA0bjSvCJT2uirD11D LXxUnwQDoO90oyjSFTSMJBRZXn83ObqWzvrtsZ/7Z7GM9+5kAcZDALt0w7/LxuU+AKim bJVnraa9s2DMAvg85AdEJYxhDTCObhafVachErmKt86j4us0npcZBchRYBxW4VRIzC/Y 1A1tPKz6kP88hdxkZWzEBQgNm1lsRYVqnrbUDkYlWp2zxPzjcWTjXkYYuw3Mx7bKHqWz 3RMvvFc0+BMQuEAC5lOLfJoLgHlni+u9VXcKvvgbdWAZmIZSorQdZpymHRPYpHtrXGXT 0TfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZmmotPLl; 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 b3-20020aa7cd03000000b0043a1b58fd45si16921776edw.601.2022.07.19.05.31.08; Tue, 19 Jul 2022 05:31:33 -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=ZmmotPLl; 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 S237462AbiGSL4c (ORCPT + 99 others); Tue, 19 Jul 2022 07:56:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237144AbiGSL4M (ORCPT ); Tue, 19 Jul 2022 07:56:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45859422F7; Tue, 19 Jul 2022 04:56:07 -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 B5A8C61604; Tue, 19 Jul 2022 11:56:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83A4DC341C6; Tue, 19 Jul 2022 11:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231765; bh=iE5yQa2DJlA8HOw9QQ5apeEo47lHRTArshMl4xWFAGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmmotPLlHr4cu1KczV1kmnj7ZyY2IRQfLfc8i3dYtsuRHvrCeU/gcabTB+okblEqE LolqvmTAu2zznLIKmjA1tyC7m+g6CPJZP9JZTUQTeNGlXOQeV3vuntIFkVTbb8kb5N tBdRd3Z7MCqHTYGmmftM7fzY0P9snhLNJiqzfx2A= 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.9 19/28] ASoC: ops: Fix off by one in range control validation Date: Tue, 19 Jul 2022 13:53:57 +0200 Message-Id: <20220719114457.981520284@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114455.701304968@linuxfoundation.org> References: <20220719114455.701304968@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 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