All of lore.kernel.org
 help / color / mirror / Atom feed
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 "FORWARD_NULL" checker.
Date: Fri, 18 Mar 2011 15:05:06 +0100	[thread overview]
Message-ID: <4D836692.2020005@ladisch.de> (raw)
In-Reply-To: <1300439668.2435.1211.camel@Sudarshan.research.nokia.com>

Sudarshan Bisht wrote:
> On Thu, 2011-03-17 at 13:08 +0100, ext Clemens Ladisch wrote:
> > sudarshan.bisht@nokia.com wrote:
> > > --- a/src/conf.c
> > > +++ b/src/conf.c
> > > @@ -3321,9 +3321,11 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
> > >  		snd_config_delete(func_conf);
> > >  	if (err >= 0) {
> > >  		snd_config_t *nroot;
> > > -		err = func(root, config, &nroot, private_data);
> > > -		if (err < 0)
> > > -			SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
> > > +		if (func) {
> > > +			err = func(root, config, &nroot, private_data);
> > > +			if (err < 0)
> > > +				SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
> > > +		}
> > 
> > The preceding "!func" and "err >= 0" checks already guarantee that
> > func is valid.
> 
> But in case of "goto _err"  , "!func" and "err >= 0" are not going to be
> checked.

"err >= 0" is checked, and in all error cases, err must be negative;
if not, this is bug at that place and should be fixed before that goto.
I now see that the TYPE_COMPOUND check forgets to set "err = -EINVAL;".


Regards,
Clemens

  reply	other threads:[~2011-03-18 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17  9:41 [PATCH 0/1] Fixed issues/defects reported by Coverity tool sudarshan.bisht
2011-03-17  9:41 ` [PATCH 1/1] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker sudarshan.bisht
2011-03-17 12:08   ` Clemens Ladisch
2011-03-18  9:14     ` Sudarshan Bisht
2011-03-18 14:05       ` Clemens Ladisch [this message]
2011-03-21  8:29         ` 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=4D836692.2020005@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.