From: Takashi Iwai Subject: Re: [PATCH 1/2] ALSA: core: fix NULL checking in snd_pcm_plug_client_size() Date: Wed, 14 Nov 2012 09:37:03 +0100 Message-ID: References: <1352844732-4764-1-git-send-email-xi.wang@gmail.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 9590B26164C for ; Wed, 14 Nov 2012 09:37:03 +0100 (CET) In-Reply-To: <1352844732-4764-1-git-send-email-xi.wang@gmail.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: Xi Wang Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Tue, 13 Nov 2012 17:12:11 -0500, Xi Wang wrote: > > The dereference snd_pcm_plug_stream(plug) should come after the NULL > check snd_BUG_ON(!plug). > > Signed-off-by: Xi Wang Applied both patches. Thanks. Takashi > --- > sound/core/oss/pcm_plugin.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c > index 71cc3dd..f0d7b15 100644 > --- a/sound/core/oss/pcm_plugin.c > +++ b/sound/core/oss/pcm_plugin.c > @@ -199,12 +199,13 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) > snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames) > { > struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; > - int stream = snd_pcm_plug_stream(plug); > + int stream; > > if (snd_BUG_ON(!plug)) > return -ENXIO; > if (drv_frames == 0) > return 0; > + stream = snd_pcm_plug_stream(plug); > if (stream == SNDRV_PCM_STREAM_PLAYBACK) { > plugin = snd_pcm_plug_last(plug); > while (plugin && drv_frames > 0) { > -- > 1.7.10.4 >