Message ID | 1032216f-902f-48f9-aa49-9d5ece8e87f2@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2732590vqy; Mon, 4 Dec 2023 04:42:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3EflRU/RGAtOI42jWaDJaG3tK5dFNlj13sb0fffELEBwdV75b0Thj3Y8+TywKV8z48Pgb X-Received: by 2002:a17:903:22c4:b0:1cf:c929:d681 with SMTP id y4-20020a17090322c400b001cfc929d681mr1593959plg.60.1701693741957; Mon, 04 Dec 2023 04:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701693741; cv=none; d=google.com; s=arc-20160816; b=m6IuLVhasIEJHV6El2ilf5Yxe/hw3u8eEMkGsEt95fiwWblVGEBVCvHzi1n7aQxVo6 lykzIzedx0+tH1dEuJbJNkU53sKOsB7P+68KBOr3RahyIaVkPfzFNt/L8d9sROa2JwY7 Sf2Pr92b0zrm55Jb5wLNvgN1pOlTTfYCGTnbznWqhx/ambBHLatLisnOqIrexYRxnlmG qscrm46WxSx28fgXQrfxhcbwb23oUX5Q8oSrqyjVeEAhvOcXq4qE5Giy84ejg7our82O FxyNIma4tIWNrpPlC/5ZdMnQ41aJDHEW2TAntGtWeXEgoJWejrPdZQ1ozzxNfUp4zxNS L+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=8x1dwoG6L6bxEjQMrtyUOBz/l2kp09gC7Z8V8HJ6Bn8=; fh=UxPRS3QCDLsgy4AtuqtGus0sz9Qskcz+mbkIPSU3++U=; b=rNuK1zRcLYGNVHqlRSrB3UP65fmarZmDJz4K7K45zbQy9K9eiB67T/1TlPE7d1/sJS 78I4SJE0fm1OFoY+mmezrPvzvYWsQLRu+y6vaAUWMBJ8ZHZ7AqoPw7gR1dI+SINGLlD4 ptbdsUFezQYueX0slSH+f2Vt+CRHj9uGiCJJQJMJIK+UZQ6aav+K8+vPVSa7LiE5pXSW UTYG/DSwlPOIo2moysfa+pdCxA++79+nMCEb3wbrX7d2ndQs1r2t5U8NDbTeBj9ZSoQK xcOkE4NCDQQn3gnf9ZeZUSwtJK196LdDJo/PHZfKbyvAEJYuRee9M21WxjHJwQB7Cg03 /Rgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YeJdh5ni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id b14-20020a170902b60e00b001cf5cc3029fsi7460608pls.548.2023.12.04.04.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 04:42:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YeJdh5ni; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A9F97805F2C8; Mon, 4 Dec 2023 04:42:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232380AbjLDMmH (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Mon, 4 Dec 2023 07:42:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbjLDMmG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 4 Dec 2023 07:42:06 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8959DA7 for <linux-kernel@vger.kernel.org>; Mon, 4 Dec 2023 04:42:12 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c09ba723eso13221275e9.2 for <linux-kernel@vger.kernel.org>; Mon, 04 Dec 2023 04:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701693731; x=1702298531; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=8x1dwoG6L6bxEjQMrtyUOBz/l2kp09gC7Z8V8HJ6Bn8=; b=YeJdh5ninM2QKZaPuVPWZQmau+UpYLchO5pRNMvWiqah6VlX8oIkPhEmnYGu+lB2Cl NEAXs2rQgLxS8nZf7dlAI2ZRbK1P68ikmj3ENClssaG4eFh23I0jgUtNkLp5yCqtIZ3B QxQpBab32f5e3YX946VrLRInUmkOgzktWhAvlF+FOOgyGWxn6zYlXGRsh7tcKlrRvj/t bQ3Ec6dqYSEmbNTFtavFTN5079EbMRvJl52WYyOW6H5OW3oLUcmsBhFgNbibFgVJnjyo zZMYlLvomHgKZgx09JUHaIyA2Wfu1b8WgSZ5up6uqgweSZMWRT60g7V3r0wGwtwvfspR 1xPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701693731; x=1702298531; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8x1dwoG6L6bxEjQMrtyUOBz/l2kp09gC7Z8V8HJ6Bn8=; b=N+CnQu2+seiAIPVs9SInd0lY1HvjUwHOe5d3lY6jAAlnkJehiEySEKBA8+gPDHG/Vv y+niPW2K/PUYLRbKoY1De8SEHtkXeQl94fBh+J971948QfsC19IeLS3Ujb4MTg1kDZMP d5Npqvf2EIcjPpJMdVNBpMtEhCaecLmtKO6cL5nWDeXRWKwYu3Pmi29ly37mUxNItHWO 0T9HbfMCFgF4CC032Y2SacHUxP1cL3DS5qJQKZJC1a/4S61n2ogNTyRA56CM7Tw61I0f h06tfCL8MAh4zD+ANEnJj6FD1IVwnh8iMRWXhcJswEuFHibmGWqeho9F75r3KnYSPlEe HisA== X-Gm-Message-State: AOJu0YwJxCs/e3xIq0pPEK+4+5V86lvv6XeZ2Oe52IT6vP9Yjd9asXAg tUlf1/+ThkSdknC7z0ZyvvSfpg== X-Received: by 2002:a05:600c:450f:b0:40a:5c71:2c3e with SMTP id t15-20020a05600c450f00b0040a5c712c3emr2172252wmo.19.1701693731047; Mon, 04 Dec 2023 04:42:11 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id f18-20020a05600c155200b004094d4292aesm14959419wmg.18.2023.12.04.04.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 04:42:10 -0800 (PST) Date: Mon, 4 Dec 2023 15:42:07 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Rob Herring <robh@kernel.org>, Charles Keepax <ckeepax@opensource.cirrus.com>, Uwe =?iso-8859-1?q?Kleine-K?= =?iso-8859-1?q?=F6nig?= <u.kleine-koenig@pengutronix.de>, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] ASoC: audio-graph-card2: fix off by one in graph_parse_node_multi_nm() Message-ID: <1032216f-902f-48f9-aa49-9d5ece8e87f2@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 04:42:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784355217272777166 X-GMAIL-MSGID: 1784355217272777166 |
Series |
ASoC: audio-graph-card2: fix off by one in graph_parse_node_multi_nm()
|
|
Commit Message
Dan Carpenter
Dec. 4, 2023, 12:42 p.m. UTC
The > comparison should be >= to avoid writing one element beyond the end
of the dai_link->ch_maps[] array. The dai_link->ch_maps[] array is
allocated in graph_parse_node_multi() and it has "nm_max" elements.
Fixes: e2de6808df4a ("ASoC: audio-graph-card2: add CPU:Codec = N:M support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
In this same function I was also concerned about these conditions:
if (cpu_idx > dai_link->num_cpus)
if (codec_idx > dai_link->num_codecs)
But I wasn't able to see out how those idx variables are actually
used.
sound/soc/generic/audio-graph-card2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Dan > The > comparison should be >= to avoid writing one element beyond the end > of the dai_link->ch_maps[] array. The dai_link->ch_maps[] array is > allocated in graph_parse_node_multi() and it has "nm_max" elements. > > Fixes: e2de6808df4a ("ASoC: audio-graph-card2: add CPU:Codec = N:M support") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > --- Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > In this same function I was also concerned about these conditions: > > if (cpu_idx > dai_link->num_cpus) > if (codec_idx > dai_link->num_codecs) > > But I wasn't able to see out how those idx variables are actually > used. These also ">=" I think. Thank you for pointing it Best regards --- Renesas Electronics Ph.D. Kuninori Morimoto
On Mon, 04 Dec 2023 15:42:07 +0300, Dan Carpenter wrote: > The > comparison should be >= to avoid writing one element beyond the end > of the dai_link->ch_maps[] array. The dai_link->ch_maps[] array is > allocated in graph_parse_node_multi() and it has "nm_max" elements. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: audio-graph-card2: fix off by one in graph_parse_node_multi_nm() commit: d685aea5e0a89b66679e5266320ab2ba4378c754 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index d9e10308a508..78d9679decda 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -557,7 +557,7 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, struct device_node *mcodec_port; int codec_idx; - if (*nm_idx > nm_max) + if (*nm_idx >= nm_max) break; mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n);