Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.intel.com,
	ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
	rander.wang@intel.com
Subject: [PATCH 01/12] ASoC: SOF: Intel: hda-stream: Do not dereference hstream until it is safe
Date: Tue,  4 Apr 2023 12:21:04 +0300	[thread overview]
Message-ID: <20230404092115.27949-2-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20230404092115.27949-1-peter.ujfalusi@linux.intel.com>

Only access hext_stream->hstream after it has been checked for NULL pointer

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
---
 sound/soc/sof/intel/hda-stream.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index c37ef581637f..50e92996f928 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -485,9 +485,8 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev,
 {
 	const struct sof_intel_dsp_desc *chip = get_chip_info(sdev->pdata);
 	struct hdac_bus *bus = sof_to_bus(sdev);
-	struct hdac_stream *hstream = &hext_stream->hstream;
-	int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
-	int ret;
+	struct hdac_stream *hstream;
+	int sd_offset, ret;
 	u32 dma_start = SOF_HDA_SD_CTL_DMA_START;
 	u32 mask;
 	u32 run;
@@ -502,6 +501,9 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev,
 		return -ENODEV;
 	}
 
+	hstream = &hext_stream->hstream;
+	sd_offset = SOF_STREAM_SD_OFFSET(hstream);
+
 	/* decouple host and link DMA */
 	mask = 0x1 << hstream->index;
 	snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
-- 
2.40.0


  reply	other threads:[~2023-04-04  9:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  9:21 [PATCH 00/12] ASoC: SOF: core/Intel: Introduce DSPless mode Peter Ujfalusi
2023-04-04  9:21 ` Peter Ujfalusi [this message]
2023-04-04  9:21 ` [PATCH 02/12] ASoC: SOF: Add flag and state which will be used for DSP-less mode Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 03/12] ASoC: SOF: Add support for DSPless mode Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 04/12] ASoC: SOF: Intel: hda: Skip interfaces not supported on a platform Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 05/12] ASoC: SOF: Intel: hda: Add support for DSPless mode Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 06/12] ASoC: SOF: Intel: hda: make DSPless mode work with DSP disabled in BIOS Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 07/12] ASoC: SOF: Intel: pci-apl: Allow DSPless mode Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 08/12] ASoC: SOF: Intel: pci-cnl: " Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 09/12] ASoC: SOF: Intel: pci-icl: " Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 10/12] ASoC: SOF: Intel: pci-mtl: " Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 11/12] ASoC: SOF: Intel: pci-skl: " Peter Ujfalusi
2023-04-04  9:21 ` [PATCH 12/12] ASoC: SOF: Intel: pci-tgl: " Peter Ujfalusi
2023-04-04 18:05 ` [PATCH 00/12] ASoC: SOF: core/Intel: Introduce " 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=20230404092115.27949-2-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.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