Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: Intel: hda-stream: Fix hext_stream dereferenced before check
@ 2025-09-23  3:22 Zhen Ni
  0 siblings, 0 replies; only message in thread
From: Zhen Ni @ 2025-09-23  3:22 UTC (permalink / raw)
  To: lgirdwood, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
	daniel.baluta, kai.vehmanen, pierre-louis.bossart, broonie, perex,
	tiwai
  Cc: linux-sound, Zhen Ni

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-23  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23  3:22 [PATCH] ASoC: SOF: Intel: hda-stream: Fix hext_stream dereferenced before check Zhen Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox