Skip to contentSkip to conversation

ALSA: hda - check NULL pointer when creating SPDIF controls

PATCH Applied [email protected] 2 participants 2 messages Mar 7, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda - check NULL pointer when creating SPDIF controls

From: Mengdong Lin <[email protected]>

If the SPDIF control array cannot be reallocated, the function will return to avoid dereferencing a NULL pointer.

sound/pci/hda/hda_codec.c +2 -0
index 04b5738..3dc6566 100644
@@ -3334,6 +3334,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
 		return -EBUSY;
 	}
 	spdif = snd_array_new(&codec->spdif_out);
+	if (!spdif)
+		return -ENOMEM;
 	for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
 		kctl = snd_ctl_new1(dig_mix, codec);
 		if (!kctl)
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

At Thu, 7 Mar 2013 14:10:25 -0500,

Quoted 7 lines · [email protected] wrote:

From: Mengdong Lin <[email protected]>

If the SPDIF control array cannot be reallocated, the function will return to avoid dereferencing a NULL pointer.

Thanks, applied.

Takashi

Quoted 17 lines
sound/pci/hda/hda_codec.c +2 -0
index 04b5738..3dc6566 100644
@@ -3334,6 +3334,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
 		return -EBUSY;
 	}
 	spdif = snd_array_new(&codec->spdif_out);
+	if (!spdif)
+		return -ENOMEM;
 	for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
 		kctl = snd_ctl_new1(dig_mix, codec);
 		if (!kctl)
Signature · 1 line
1.7.10.4