From patchwork Fri Jul 13 15:11:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10523561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27E856028E for ; Fri, 13 Jul 2018 15:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13FB929D3C for ; Fri, 13 Jul 2018 15:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0725F29D42; Fri, 13 Jul 2018 15:11:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 586D529D3C for ; Fri, 13 Jul 2018 15:11:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C512A267729; Fri, 13 Jul 2018 17:11:22 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A46D926772C; Fri, 13 Jul 2018 17:11:19 +0200 (CEST) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by alsa0.perex.cz (Postfix) with ESMTP id 973C8267727 for ; Fri, 13 Jul 2018 17:11:17 +0200 (CEST) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6DF5V9m171965; Fri, 13 Jul 2018 15:11:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=Fvj46MyTq4oHVupfOiptQWnzb9dCCHFV8UEEL8ujy4M=; b=Y2cqmDq1F7sSQJlyRG2yTnTL9A58gfsBTt1I4lshnJJBh1iHcuGNfRFgK9SZSBmZtmFE xXJpCY6yidEslJzW4yEIpv9VQZT6H8LoGJWAeE0jiVfrYlFvGAzF+0PDGCVAvxYJSQuJ mzBMDcACzBUk39PiVTz4cVjhQWEXYikCWBwT92I/kzlTCMatIN+ZJbLrrDKOdjMdmSGa xFdS52MJ1SqXLPzzIaUX+Pr8LPW5xLIC/yNscTmEntlhAaG3Ne7RjIB0+FmfZ3Bf972z Mj6MIjKFdSNmNfKYgcC+993CHIdNv/AbEniecT/ViTL5b2EsDsuIHnnwnMaGxYJFg6AZ FQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2k2p7e88vc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jul 2018 15:11:16 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w6DFBFrL013727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jul 2018 15:11:15 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6DFBEZc021036; Fri, 13 Jul 2018 15:11:14 GMT Received: from kili.mountain (/41.202.241.35) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jul 2018 08:11:13 -0700 Date: Fri, 13 Jul 2018 18:11:04 +0300 From: Dan Carpenter To: Patrick Lai , Srinivas Kandagatla Message-ID: <20180713151100.x5usbqhlhrzjmeoq@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8953 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=669 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807130129 Cc: alsa-devel@alsa-project.org, Banajit Goswami , kernel-janitors@vger.kernel.org, Takashi Iwai , Liam Girdwood , Mark Brown , Niklas Cassel Subject: [alsa-devel] [PATCH] ASoC: qdsp6: q6routing: off by one in routing_hw_params() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The data->port_data[] array has AFE_MAX_PORTS elements so the check should be >= instead of > or we write one element beyond the end of the array. Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver") Signed-off-by: Dan Carpenter Acked-by: Srinivas Kandgatla diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c index 35269b492761..0e7cf9e35d51 100644 --- a/sound/soc/qcom/qdsp6/q6routing.c +++ b/sound/soc/qcom/qdsp6/q6routing.c @@ -927,7 +927,7 @@ static int routing_hw_params(struct snd_pcm_substream *substream, else path_type = ADM_PATH_LIVE_REC; - if (be_id > AFE_MAX_PORTS) + if (be_id >= AFE_MAX_PORTS) return -EINVAL; session = &data->port_data[be_id];