Skip to content

Commit

Permalink
ALSA: hda: fix possible null dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sudip Mukherjee authored and Takashi Iwai committed Apr 4, 2015
1 parent 382fd7b commit 751e221
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3230,9 +3230,8 @@ static int add_std_chmaps(struct hda_codec *codec)
struct snd_pcm_chmap *chmap;
const struct snd_pcm_chmap_elem *elem;

if (pcm->own_chmap)
continue;
if (!pcm || !hinfo->substreams)
if (!pcm || pcm->own_chmap ||
!hinfo->substreams)
continue;
elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
err = snd_pcm_add_chmap_ctls(pcm->pcm, str, elem,
Expand Down

0 comments on commit 751e221

Please sign in to comment.