From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754882Ab3CLHfE (ORCPT ); Tue, 12 Mar 2013 03:35:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56497 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114Ab3CLHfC (ORCPT ); Tue, 12 Mar 2013 03:35:02 -0400 Date: Tue, 12 Mar 2013 08:34:55 +0100 Message-ID: From: Takashi Iwai To: Wei Yongjun Cc: perex@perex.cz, yongjun_wei@trendmicro.com.cn, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: asihpi - fix potential NULL pointer dereference In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Tue, 12 Mar 2013 00:16:40 +0800, Wei Yongjun wrote: > > From: Wei Yongjun > > The dereference should be moved below the NULL test. > > Signed-off-by: Wei Yongjun Applied now. Thanks. Takashi > --- > sound/pci/asihpi/asihpi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c > index 3536b07..0aabfed 100644 > --- a/sound/pci/asihpi/asihpi.c > +++ b/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) > { > - struct snd_card *card = asihpi->card; > + struct snd_card *card; > unsigned int idx = 0; > unsigned int subindex = 0; > int err; > @@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) > > if (snd_BUG_ON(!asihpi)) > return -EINVAL; > + card = asihpi->card; > strcpy(card->mixername, "Asihpi Mixer"); > > err = > >