From nobody Fri Sep 5 20:24:36 2025 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 2793CC32772 for ; Tue, 23 Aug 2022 11:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355936AbiHWLjn (ORCPT ); Tue, 23 Aug 2022 07:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357951AbiHWLc2 (ORCPT ); Tue, 23 Aug 2022 07:32:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1399290C6F; Tue, 23 Aug 2022 02:26:52 -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 0BAF761330; Tue, 23 Aug 2022 09:26:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15346C433C1; Tue, 23 Aug 2022 09:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246811; bh=+NeAf9h5pfFDUXnKms+x2U0x3UtSbInesnl7Zo/kjxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xkCQiJi2UVeA8A2WBOuujoXM2SuMBjV4yPPSR9yxgQiD0S/XxO6aNuYR9CnT6uY0R Boj5NZ9eoDA4XC5IokvB6tB3uXNn/UruXT9df+8gvPrg6rRm3WlVeApcqcsr5U/Uab GWF1bd68nHRNFnDItmwwLo02mqNLQKoULAdHPF0I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.4 226/389] ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp() Date: Tue, 23 Aug 2022 10:25:04 +0200 Message-Id: <20220823080125.041533349@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ] find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here. So 'idx' should be tested with ">=3D" or the test can't match. Fixes: 7b20b2be51e1 ("ASoC: qdsp6: q6adm: Add q6adm driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0fca3271649736053eb9649d87e1ca01b056be40.16= 58394124.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/qdsp6/q6adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c index da242515e146..8e3539941fad 100644 --- a/sound/soc/qcom/qdsp6/q6adm.c +++ b/sound/soc/qcom/qdsp6/q6adm.c @@ -217,7 +217,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *ad= m, int port_idx) idx =3D find_first_zero_bit(&adm->copp_bitmap[port_idx], MAX_COPPS_PER_PORT); =20 - if (idx > MAX_COPPS_PER_PORT) + if (idx >=3D MAX_COPPS_PER_PORT) return ERR_PTR(-EBUSY); =20 c =3D kzalloc(sizeof(*c), GFP_ATOMIC); --=20 2.35.1