[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b38b3159-2d77-f4fd-f269-d708eb1a90a5@linux.intel.com>
Date: Fri, 1 Jul 2022 13:58:53 +0300
From: Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>
To: Brent Lu <brent.lu@...el.com>, alsa-devel@...a-project.org
Cc: Cezary Rojewski <cezary.rojewski@...el.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Takashi Iwai <tiwai@...e.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Liam Girdwood <liam.r.girdwood@...ux.intel.com>,
Mac Chiang <mac.chiang@...el.com>,
Mark Brown <broonie@...nel.org>,
Ajye Huang <ajye.huang@...il.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
linux-kernel@...r.kernel.org, Yong Zhi <yong.zhi@...el.com>
Subject: Re: [PATCH] ASoC: Intel: sof_rt5682: fix out-of-bounds array access
On 01/07/2022 11:19, Brent Lu wrote:
> Starting from ADL platform we have four HDMI PCM devices which exceeds
> the size of sof_hdmi array. Since each sof_hdmi_pcm structure
> represents one HDMI PCM device, we remove the sof_hdmi array and add a
> new member hdmi_jack to the snd_soc_jack structure to fix the
"new member hdmi_jack to the sof_hdmi_pcm structure to fix the"
> out-of-bounds problem.
Other than that:
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>
> Signed-off-by: Brent Lu <brent.lu@...el.com>
> ---
> sound/soc/intel/boards/sof_rt5682.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index a24fb71d5ff3..1384716c6360 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -69,11 +69,10 @@ static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
>
> static int is_legacy_cpu;
>
> -static struct snd_soc_jack sof_hdmi[3];
> -
> struct sof_hdmi_pcm {
> struct list_head head;
> struct snd_soc_dai *codec_dai;
> + struct snd_soc_jack hdmi_jack;
> int device;
> };
>
> @@ -447,7 +446,6 @@ static int sof_card_late_probe(struct snd_soc_card *card)
> char jack_name[NAME_SIZE];
> struct sof_hdmi_pcm *pcm;
> int err;
> - int i = 0;
>
> /* HDMI is not supported by SOF on Baytrail/CherryTrail */
> if (is_legacy_cpu || !ctx->idisp_codec)
> @@ -468,17 +466,15 @@ static int sof_card_late_probe(struct snd_soc_card *card)
> snprintf(jack_name, sizeof(jack_name),
> "HDMI/DP, pcm=%d Jack", pcm->device);
> err = snd_soc_card_jack_new(card, jack_name,
> - SND_JACK_AVOUT, &sof_hdmi[i]);
> + SND_JACK_AVOUT, &pcm->hdmi_jack);
>
> if (err)
> return err;
>
> err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
> - &sof_hdmi[i]);
> + &pcm->hdmi_jack);
> if (err < 0)
> return err;
> -
> - i++;
> }
>
> if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {
--
Péter
Powered by blists - more mailing lists