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 6AA75C63708 for ; Mon, 5 Dec 2022 19:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbiLETOu (ORCPT ); Mon, 5 Dec 2022 14:14:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232726AbiLETO3 (ORCPT ); Mon, 5 Dec 2022 14:14:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F95C1F2FC for ; Mon, 5 Dec 2022 11:14:28 -0800 (PST) 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 4481BB81201 for ; Mon, 5 Dec 2022 19:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5AB0C433C1; Mon, 5 Dec 2022 19:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1670267666; bh=NSsEic6aRvSnBjUPRvE9nxR/IvJN9h8aQ8XkbEDyRkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0vPe359dL8bwtxzYzUGZSX8/CE0ffc73Fawh6cfiEQY2Rp8FIY8IDmCy36fPkzjw xdiHPo/N7ylEk7oGpnplrH0cH9Vxg+kQpfRUrGyLDDg4Uc2VYatV2HhLDE46tI4nM9 wPfL94nmvZ6LS1qgduB82kY6UlSxkqHuYAyd0ERE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mark Brown , Sasha Levin Subject: [PATCH 4.9 52/62] ASoC: ops: Fix bounds check for _sx controls Date: Mon, 5 Dec 2022 20:09:49 +0100 Message-Id: <20221205190800.050279118@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221205190758.073114639@linuxfoundation.org> References: <20221205190758.073114639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Brown [ Upstream commit 698813ba8c580efb356ace8dbf55f61dac6063a8 ] For _sx controls the semantics of the max field is not the usual one, max is the number of steps rather than the maximum value. This means that our check in snd_soc_put_volsw_sx() needs to just check against the maximum value. Fixes: 4f1e50d6a9cf9c1b ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx()") Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220511134137.169575-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 4fda8c24be29..5479927391d4 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -450,7 +450,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, val = ucontrol->value.integer.value[0]; if (mc->platform_max && val > mc->platform_max) return -EINVAL; - if (val > max - min) + if (val > max) return -EINVAL; if (val < 0) return -EINVAL; -- 2.35.1