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 Kleine-König" <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()
Date: Mon, 4 Dec 2023 15:42:07 +0300 [thread overview]
Message-ID: <1032216f-902f-48f9-aa49-9d5ece8e87f2@moroto.mountain> (raw)
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(-)
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);
--
2.42.0
next reply other threads:[~2023-12-04 12:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 12:42 Dan Carpenter [this message]
2023-12-07 1:00 ` Kuninori Morimoto
2023-12-07 18:25 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1032216f-902f-48f9-aa49-9d5ece8e87f2@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®