Skip to content

Commit 751e221

Browse files
sudipm-mukherjeetiwai
authored andcommitted
ALSA: hda: fix possible null dereference
we are dereferencing pcm first then checking pcm. instead now lets put them in same if condition so that pcm is checked first. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 382fd7b commit 751e221

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sound/pci/hda/hda_codec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,9 +3230,8 @@ static int add_std_chmaps(struct hda_codec *codec)
32303230
struct snd_pcm_chmap *chmap;
32313231
const struct snd_pcm_chmap_elem *elem;
32323232

3233-
if (pcm->own_chmap)
3234-
continue;
3235-
if (!pcm || !hinfo->substreams)
3233+
if (!pcm || pcm->own_chmap ||
3234+
!hinfo->substreams)
32363235
continue;
32373236
elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
32383237
err = snd_pcm_add_chmap_ctls(pcm->pcm, str, elem,

0 commit comments

Comments
 (0)