Skip to content

Commit 430cd76

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 908257c commit 430cd76

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
@@ -419,16 +419,20 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
419419
struct snd_dma_buffer *dmab,
420420
struct snd_pcm_hw_params *params)
421421
{
422-
struct hdac_stream *hstream = &hext_stream->hstream;
423-
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
422+
struct hdac_stream *hstream;
423+
int sd_offset;
424424
int ret;
425-
u32 mask = 0x1 << hstream->index;
425+
u32 mask;
426426

427427
if (!hext_stream) {
428428
dev_err(sdev->dev, "error: no stream available\n");
429429
return -ENODEV;
430430
}
431431

432+
hstream = &hext_stream->hstream;
433+
sd_offset = SOF_STREAM_SD_OFFSET(hstream);
434+
mask = 0x1 << hstream->index;
435+
432436
if (!dmab) {
433437
dev_err(sdev->dev, "error: no dma buffer allocated!\n");
434438
return -ENODEV;

0 commit comments

Comments
 (0)