From: Colin Ian King <colin.king@canonical.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Patrick Lai <plai@codeaurora.org>,
Banajit Goswami <bgoswami@codeaurora.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
alsa-devel@alsa-project.org
Subject: re: ASoC: qcom: sm8250: add sound card qrb5165-rb5 support
Date: Wed, 28 Oct 2020 12:15:28 +0000 [thread overview]
Message-ID: <f441bb6c-12eb-a565-c34d-950da2b045d7@canonical.com> (raw)
Hi,
Static analysis on linux-next with Coverity had detected a potential
array out-of-bounds write issue in the following commit:
commit aa2e2785545aab21b6cb2e23f111ae0751cbcca7
Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Mon Oct 26 17:09:47 2020 +0000
ASoC: qcom: sm8250: add sound card qrb5165-rb5 support
The analysis is as follows:
139 static int sm8250_snd_hw_free(struct snd_pcm_substream *substream)
140 {
141 struct snd_soc_pcm_runtime *rtd = substream->private_data;
142 struct sm8250_snd_data *data =
snd_soc_card_get_drvdata(rtd->card);
143 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
144 struct sdw_stream_runtime *sruntime =
data->sruntime[cpu_dai->id];
145
1. Switch case value 105.
146 switch (cpu_dai->id) {
2. equality_cond: Jumping to case 105.
147 case WSA_CODEC_DMA_RX_0:
148 case WSA_CODEC_DMA_RX_1:
Out-of-bounds write (OVERRUN)
3. Condition sruntime, taking true branch.
4. Condition data->stream_prepared[cpu_dai->id], taking true branch.
149 if (sruntime && data->stream_prepared[cpu_dai->id]) {
150 sdw_disable_stream(sruntime);
151 sdw_deprepare_stream(sruntime);
Out-of-bounds write (OVERRUN)
5. overrun-local: Overrunning array data->stream_prepared of 16 bytes
at byte offset 105 using index cpu_dai->id (which evaluates to 105).
152 data->stream_prepared[cpu_dai->id] = false;
153 }
154 break;
155 default:
156 break;
157 }
158
159 return 0;
160 }
So cpu_dia->id is 105 in this case statement, and yet
data->steam_prepared is an array of 16 elements, so this looks suspect.
Colin
next reply other threads:[~2020-10-29 0:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 12:15 Colin Ian King [this message]
2020-10-28 14:20 ` Srinivas Kandagatla
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=f441bb6c-12eb-a565-c34d-950da2b045d7@canonical.com \
--to=colin.king@canonical.com \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/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®