Просмотр исходного кода

ALSA: asihpi - fix potential NULL pointer dereference

The dereference should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Wei Yongjun 12 лет назад
Родитель
Сommit
2e9b9a3c24
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      sound/pci/asihpi/asihpi.c

+ 2 - 1
sound/pci/asihpi/asihpi.c

@@ -2549,7 +2549,7 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
 
 
 static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
 static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
 {
 {
-	struct snd_card *card = asihpi->card;
+	struct snd_card *card;
 	unsigned int idx = 0;
 	unsigned int idx = 0;
 	unsigned int subindex = 0;
 	unsigned int subindex = 0;
 	int err;
 	int err;
@@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
 
 
 	if (snd_BUG_ON(!asihpi))
 	if (snd_BUG_ON(!asihpi))
 		return -EINVAL;
 		return -EINVAL;
+	card = asihpi->card;
 	strcpy(card->mixername, "Asihpi Mixer");
 	strcpy(card->mixername, "Asihpi Mixer");
 
 
 	err =
 	err =