Skip to content

Commit d0b2825

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 c87f914 commit d0b2825

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
@@ -445,16 +445,20 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
445445
struct snd_dma_buffer *dmab,
446446
struct snd_pcm_hw_params *params)
447447
{
448-
struct hdac_stream *hstream = &hext_stream->hstream;
449-
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
448+
struct hdac_stream *hstream;
449+
int sd_offset;
450450
int ret;
451-
u32 mask = 0x1 << hstream->index;
451+
u32 mask;
452452

453453
if (!hext_stream) {
454454
dev_err(sdev->dev, "error: no stream available\n");
455455
return -ENODEV;
456456
}
457457

458+
hstream = &hext_stream->hstream;
459+
sd_offset = SOF_STREAM_SD_OFFSET(hstream);
460+
mask = 0x1 << hstream->index;
461+
458462
if (!dmab) {
459463
dev_err(sdev->dev, "error: no dma buffer allocated!\n");
460464
return -ENODEV;

0 commit comments

Comments
 (0)