Skip to content

Commit f101e4e

Browse files
Ethan Tidmoregregkh
authored andcommitted
ASoC: SOF: Intel: hda: Place check before dereference
[ Upstream commit 6cbc836 ] 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: aca961f ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2958b39 commit f101e4e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

sound/soc/sof/intel/hda-stream.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,16 +415,20 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
415415
struct snd_dma_buffer *dmab,
416416
struct snd_pcm_hw_params *params)
417417
{
418-
struct hdac_stream *hstream = &hext_stream->hstream;
419-
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
418+
struct hdac_stream *hstream;
419+
int sd_offset;
420420
int ret;
421-
u32 mask = 0x1 << hstream->index;
421+
u32 mask;
422422

423423
if (!hext_stream) {
424424
dev_err(sdev->dev, "error: no stream available\n");
425425
return -ENODEV;
426426
}
427427

428+
hstream = &hext_stream->hstream;
429+
sd_offset = SOF_STREAM_SD_OFFSET(hstream);
430+
mask = 0x1 << hstream->index;
431+
428432
if (!dmab) {
429433
dev_err(sdev->dev, "error: no dma buffer allocated!\n");
430434
return -ENODEV;

0 commit comments

Comments
 (0)