Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Zhen Ni <zhen.ni@easystack.cn>
To: lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com,
	yung-chuan.liao@linux.intel.com,
	ranjani.sridharan@linux.intel.com, daniel.baluta@nxp.com,
	kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.dev,
	broonie@kernel.org, perex@perex.cz, tiwai@suse.com
Cc: linux-sound@vger.kernel.org, Zhen Ni <zhen.ni@easystack.cn>
Subject: [PATCH] ASoC: SOF: Intel: hda-stream: Fix hext_stream dereferenced before check
Date: Tue, 23 Sep 2025 11:22:41 +0800	[thread overview]
Message-ID: <20250923032241.1112260-1-zhen.ni@easystack.cn> (raw)

hext_stream dereferenced before check:
int hda_dsp_iccmax_stream_hw_params(...,
				struct hdac_ext_stream *hext_stream,...)
{
        struct hdac_stream *hstream = &hext_stream->hstream;
				       ^^^^^^^^^^^^^^^^^^^^
Dereferenced
	...

        if (!hext_stream) {
	    ^^^^^^^^^^^^
Checked too late.
                dev_err(sdev->dev, "error: no stream available\n");
                return -ENODEV;
        }
	...
}
The caller hda_cl_prepare() guarantees that the parameter hext_stream
passed to hda_dsp_iccmax_stream_hw_params() is non-NULL. Finally, we
don't need to check the hext_stream and it should be valid. Removes the
hext_stream check.

Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 sound/soc/sof/intel/hda-stream.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index a34f472ef175..6bcaed86e403 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -450,11 +450,6 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
 	int ret;
 	u32 mask = 0x1 << hstream->index;
 
-	if (!hext_stream) {
-		dev_err(sdev->dev, "error: no stream available\n");
-		return -ENODEV;
-	}
-
 	if (!dmab) {
 		dev_err(sdev->dev, "error: no dma buffer allocated!\n");
 		return -ENODEV;
-- 
2.20.1


                 reply	other threads:[~2025-09-23  7:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250923032241.1112260-1-zhen.ni@easystack.cn \
    --to=zhen.ni@easystack.cn \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@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