[alsa-devel] [PATCH] ALSA: hda - check NULL pointer when creating SPDIF controls
From: Mengdong Lin mengdong.lin@intel.com
If the SPDIF control array cannot be reallocated, the function will return to avoid dereferencing a NULL pointer.
Signed-off-by: Mengdong Lin mengdong.lin@intel.com
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 04b5738..3dc6566 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -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)
At Thu, 7 Mar 2013 14:10:25 -0500, mengdong.lin@intel.com wrote:
From: Mengdong Lin mengdong.lin@intel.com
If the SPDIF control array cannot be reallocated, the function will return to avoid dereferencing a NULL pointer.
Signed-off-by: Mengdong Lin mengdong.lin@intel.com
Thanks, applied.
Takashi
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 04b5738..3dc6566 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -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)
for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { kctl = snd_ctl_new1(dig_mix, codec); if (!kctl)return -ENOMEM;
-- 1.7.10.4
participants (2)
-
mengdong.lin@intel.com
-
Takashi Iwai