From: Takashi Iwai Subject: Re: [PATCH] ALSA: hda - check NULL pointer when creating SPDIF controls Date: Thu, 07 Mar 2013 09:13:13 +0100 Message-ID: References: <1362683425-19113-1-git-send-email-mengdong.lin@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 1E0542615E8 for ; Thu, 7 Mar 2013 09:13:15 +0100 (CET) In-Reply-To: <1362683425-19113-1-git-send-email-mengdong.lin@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: mengdong.lin@intel.com Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Thu, 7 Mar 2013 14:10:25 -0500, mengdong.lin@intel.com wrote: > > From: Mengdong Lin > > If the SPDIF control array cannot be reallocated, the function > will return to avoid dereferencing a NULL pointer. > > Signed-off-by: Mengdong Lin 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) > + return -ENOMEM; > for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { > kctl = snd_ctl_new1(dig_mix, codec); > if (!kctl) > -- > 1.7.10.4 >