Skip to contentSkip to conversation

ASoC: SOF: Intel: hda-stream: Fix hext_stream dereferenced before check

PATCH New Zhen Ni 1 participant 1 message Sep 23, 2025

Subsystems (3)
lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

PATCH 1/1 ASoC: SOF: Intel: hda-stream: Fix hext_stream dereferenced before check

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.

---
 sound/soc/sof/intel/hda-stream.c | 5 -----
 1 file changed, 5 deletions(-)
sound/soc/sof/intel/hda-stream.c +0 -5
index a34f472ef175..6bcaed86e403 100644
@@ -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;
Signature · 1 line
2.20.1