From: Clemens Ladisch <clemens@ladisch.de>
To: sudarshan.bisht@nokia.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker.
Date: Thu, 17 Mar 2011 12:29:41 +0100 [thread overview]
Message-ID: <4D81F0A5.7080604@ladisch.de> (raw)
In-Reply-To: <1300354087-755-2-git-send-email-sudarshan.bisht@nokia.com>
sudarshan.bisht@nokia.com wrote:
> --- a/src/control/setup.c
> +++ b/src/control/setup.c
> @@ -398,7 +398,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
>
> static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_data)
> {
> - snd_config_t *conf;
> + snd_config_t *conf = NULL ;
> snd_config_iterator_t i, next;
> char *tmp;
> int iface = SND_CTL_ELEM_IFACE_MIXER;
> @@ -415,6 +415,7 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
> err = snd_config_expand(_conf, _conf, NULL, private_data, &conf);
> if (err < 0)
> return err;
> + assert(conf);
> snd_config_for_each(i, next, conf) {
> snd_config_t *n = snd_config_iterator_entry(i);
> const char *id;
The last parameter of snd_config_expand() is an output parameter, and
it is guaranteed that this parameter is set when the function succeeds.
If Coverity isn't able to derive this from the code, it might be
defensible to add annotations to snd_config_expand() to make the
semantics clear, but it is not acceptable to modify each caller just
to work around shortcomings in a tool.
Regards,
Clemens
next prev parent reply other threads:[~2011-03-17 11:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 9:28 [PATCH 0/1] Fixed issues/defects reported by Coverity tool sudarshan.bisht
2011-03-17 9:28 ` [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker sudarshan.bisht
2011-03-17 11:29 ` Clemens Ladisch [this message]
2011-03-17 14:02 ` Sudarshan Bisht
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=4D81F0A5.7080604@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=sudarshan.bisht@nokia.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.