diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-04-02 07:21:43 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-04 08:32:16 -0400 |
commit | 751e2216899cb143fe1d5909fe762870faa945f6 (patch) | |
tree | d69612e15878e09eef8498c414c27c360d422ad4 | |
parent | 382fd7becc409be9cc18dea8e3d53f6d184f9a5c (diff) |
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>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 41851f9b48c1..16dfa1ed10dd 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3230,9 +3230,8 @@ static int add_std_chmaps(struct hda_codec *codec) | |||
3230 | struct snd_pcm_chmap *chmap; | 3230 | struct snd_pcm_chmap *chmap; |
3231 | const struct snd_pcm_chmap_elem *elem; | 3231 | const struct snd_pcm_chmap_elem *elem; |
3232 | 3232 | ||
3233 | if (pcm->own_chmap) | 3233 | if (!pcm || pcm->own_chmap || |
3234 | continue; | 3234 | !hinfo->substreams) |
3235 | if (!pcm || !hinfo->substreams) | ||
3236 | continue; | 3235 | continue; |
3237 | elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps; | 3236 | elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps; |
3238 | err = snd_pcm_add_chmap_ctls(pcm->pcm, str, elem, | 3237 | err = snd_pcm_add_chmap_ctls(pcm->pcm, str, elem, |