From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844Ab0LUHFE (ORCPT ); Tue, 21 Dec 2010 02:05:04 -0500 Received: from cantor.suse.de ([195.135.220.2]:36552 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452Ab0LUHFD (ORCPT ); Tue, 21 Dec 2010 02:05:03 -0500 Date: Tue, 21 Dec 2010 08:04:59 +0100 Message-ID: From: Takashi Iwai To: Jesper Juhl Cc: Jaroslav Kysela , Krzysztof Helt , Clemens Ladisch , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sound, core, pcm_lib: remember to always call va_end() on stuff that we va_start() In-Reply-To: References: User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.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, 21 Dec 2010 00:03:17 +0100 (CET), Jesper Juhl wrote: > > Hi, > > The Coverity checker spotted that we do not always remember to call > va_end() on 'args' in failure paths in snd_pcm_hw_rule_add(). > Here's a patch to fix that up (compile tested only) - it also removes > some annoying trailing whitespace that caught my eye while I was in the > area.. > > Signed-off-by: Jesper Juhl Thanks, applied now. Takashi > --- > pcm_lib.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c > index b75db8e..11446a1 100644 > --- a/sound/core/pcm_lib.c > +++ b/sound/core/pcm_lib.c > @@ -1070,8 +1070,10 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, > struct snd_pcm_hw_rule *new; > unsigned int new_rules = constrs->rules_all + 16; > new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); > - if (!new) > + if (!new) { > + va_end(args); > return -ENOMEM; > + } > if (constrs->rules) { > memcpy(new, constrs->rules, > constrs->rules_num * sizeof(*c)); > @@ -1087,8 +1089,10 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, > c->private = private; > k = 0; > while (1) { > - if (snd_BUG_ON(k >= ARRAY_SIZE(c->deps))) > + if (snd_BUG_ON(k >= ARRAY_SIZE(c->deps))) { > + va_end(args); > return -EINVAL; > + } > c->deps[k++] = dep; > if (dep < 0) > break; > @@ -1097,7 +1101,7 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, > constrs->rules_num++; > va_end(args); > return 0; > -} > +} > > EXPORT_SYMBOL(snd_pcm_hw_rule_add); > > > > -- > Jesper Juhl http://www.chaosbits.net/ > Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html > Plain text mails only, please. >