Skip to content

Commit 084ca21

Browse files
crojewsk-inteltiwai
authored andcommitted
ALSA: hda: Error out if invalid stream is being setup
Scenario when snd_hdac_stream_setup_periods() receives an instance of struct hdac_stream with neither ->substream nor ->cstream initialized is invalid. Simultaneously addresses "uninitialized symbol 'dmab'" error reported by Smatch. Fixes: 3e95822 ("ALSA: hda: Interrupt servicing and BDL setup for compress streams") Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221208142635.1514944-1-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a587601 commit 084ca21

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sound/hda/hdac_stream.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
500500
dmab = snd_pcm_get_dma_buf(substream);
501501
} else if (cstream) {
502502
dmab = snd_pcm_get_dma_buf(cstream);
503+
} else {
504+
WARN(1, "No substream or cstream assigned\n");
505+
return -EINVAL;
503506
}
504507

505508
/* reset BDL address */

0 commit comments

Comments
 (0)