From: Takashi Iwai <tiwai@suse.de>
To: Jesper Juhl <jj@chaosbits.net>
Cc: Jaroslav Kysela <perex@perex.cz>,
Krzysztof Helt <krzysztof.h1@wp.pl>,
Clemens Ladisch <clemens@ladisch.de>,
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()
Date: Tue, 21 Dec 2010 08:04:59 +0100 [thread overview]
Message-ID: <s5hwrn3obc4.wl%tiwai@suse.de> (raw)
In-Reply-To: <alpine.LNX.2.00.1012202357150.23785@swampdragon.chaosbits.net>
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 <jj@chaosbits.net>
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 <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
>
prev parent reply other threads:[~2010-12-21 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 23:03 Jesper Juhl
2010-12-21 7:04 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hwrn3obc4.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=jj@chaosbits.net \
--cc=krzysztof.h1@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®