Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: SOF: Intel: hda: Place check before dereference

The struct hext_stream is dereferenced before it is checked for NULL.
Although it can never be NULL due to a check prior to
hda_dsp_iccmax_stream_hw_params() being called, this change clears any
confusion regarding hext_stream possibly being NULL.

Check hext_stream for NULL and then assign its members.

Detected by Smatch:
sound/soc/sof/intel/hda-stream.c:488 hda_dsp_iccmax_stream_hw_params() warn:
variable dereferenced before check 'hext_stream' (see line 486)

Fixes: aca961f196e5d ("ASoC: SOF: Intel: hda: Add helper function to program ICCMAX stream")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Link: https://patch.msgid.link/20260324173830.17563-1-ethantidmore06@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ethan Tidmore and committed by
Mark Brown
6cbc8360 9968aad1

+7 -3
+7 -3
sound/soc/sof/intel/hda-stream.c
··· 480 480 struct snd_dma_buffer *dmab, 481 481 struct snd_pcm_hw_params *params) 482 482 { 483 - struct hdac_stream *hstream = &hext_stream->hstream; 484 - int sd_offset = SOF_STREAM_SD_OFFSET(hstream); 483 + struct hdac_stream *hstream; 484 + int sd_offset; 485 485 int ret; 486 - u32 mask = 0x1 << hstream->index; 486 + u32 mask; 487 487 488 488 if (!hext_stream) { 489 489 dev_err(sdev->dev, "error: no stream available\n"); 490 490 return -ENODEV; 491 491 } 492 + 493 + hstream = &hext_stream->hstream; 494 + sd_offset = SOF_STREAM_SD_OFFSET(hstream); 495 + mask = 0x1 << hstream->index; 492 496 493 497 if (!dmab) { 494 498 dev_err(sdev->dev, "error: no dma buffer allocated!\n");