Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3023659rwb; Mon, 15 Aug 2022 16:21:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Yt5lFkv4amMfkYlaBaNHxz/oq3UEZWUQAkDHY7BZDQkn3EMV5LZ7ZqB0mVdLGNsurjGGI X-Received: by 2002:a05:6402:84e:b0:440:4bac:be5a with SMTP id b14-20020a056402084e00b004404bacbe5amr16353242edz.103.1660605674541; Mon, 15 Aug 2022 16:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605674; cv=none; d=google.com; s=arc-20160816; b=fYpU9qRTskwceUGNIjcTuhxNkpV84eu2qz5RnSs+mFp/OvbJC6d1ragHlErzPzHUkJ sesyxsa/Q8RhyZmZsivzQMV47Zxqvyv9xm/m/+AsPEymKq6msVoTlfj2SFAx7sld+f/l uxabZbJh7SdQecVpiwAip03d+viHsYz5i2G19HH7UKWu++1RCE7G4wLPxdG2D/COGHOO /6QhpWoSbk9LvuH99G0Ug/Z7ZtupxAAvRZ/pB3mks/S3WiK9QChUA4JCeHmbFxmSNNC5 Sm5l3nDMXJEakmhgC7uAlvwTCCwyWeBMEietSCkJ1Wwhimsvhu2lnI6rB3p9jjX4AQhW SImQ== 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=btA7lrVJSCc4N/5s+5Wxo/WqKcQVImWslm+2Ziy6Qeo=; b=dUaZHH0XsYlGvNIAg6nWpB7IBPnXGmBN5NUOSqvdvTKmb+4qWr04+vCHKWxKSSi2Vm UTeMWTG0sxLZHgryUfzYVMcOHIUNidoadlZeXNHNhcI8Ai+6bxgamIubDtGHpLILiZ9G 0SkpL3XBEsu8flh+psvZvkGoks9Dkg/hnsvb8ocH6gG5rd55XhUDxXnlfkYDrc6K+sGF XschziPXyu+u5RAMtlPnHR/IY47MzOhPiuPMdBcsAHU4vRnF6c04LDjbeur6/GaUrAil UTwgHeXpJD4aQAlsqp+hs99+xv0fknrD96OF3HbO/4iaY4mfGiKyGd9RmnT6s2E/6Epu mURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hop7YbLB; 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 sc20-20020a1709078a1400b0073121897f72si7621233ejc.937.2022.08.15.16.20.49; Mon, 15 Aug 2022 16:21:14 -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=Hop7YbLB; 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 S1350689AbiHOWsI (ORCPT + 99 others); Mon, 15 Aug 2022 18:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350518AbiHOWoa (ORCPT ); Mon, 15 Aug 2022 18:44:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 033B1133A62; Mon, 15 Aug 2022 12:52:37 -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 2D38461206; Mon, 15 Aug 2022 19:52:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AFF6C433D6; Mon, 15 Aug 2022 19:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593156; bh=ELguIUk4SGcF73osMAg65DOO9y8WrYs9XvjG4oFTOso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hop7YbLBhmkzSKN6N8WRGefhwpgZZXKSrLtD6HxYzYpNKMlUvSH13gF2XlBeGQLH4 /bGlMH+SoVYgRgSqe8LBea8vfAPSB4/xi3Oi3eKsqGani5u5adwj/QVmNNaexDqj0g qBzX4aGXFdXK1t6y3O3wf6EDbSiIHB0DTU4XTsPc= 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.18 0904/1095] ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp() Date: Mon, 15 Aug 2022 20:05:03 +0200 Message-Id: <20220815180506.699055084@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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: Christophe JAILLET [ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ] find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here. So 'idx' should be tested with ">=" 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.1658394124.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 72c5719f1d25..a0678e8cf20a 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 *adm, int port_idx) idx = find_first_zero_bit(&adm->copp_bitmap[port_idx], MAX_COPPS_PER_PORT); - if (idx > MAX_COPPS_PER_PORT) + if (idx >= MAX_COPPS_PER_PORT) return ERR_PTR(-EBUSY); c = kzalloc(sizeof(*c), GFP_ATOMIC); -- 2.35.1