[alsa-devel] [PATCH 1/1] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker.

Clemens Ladisch clemens at ladisch.de
Fri Mar 18 15:05:06 CET 2011


Sudarshan Bisht wrote:
> On Thu, 2011-03-17 at 13:08 +0100, ext Clemens Ladisch wrote:
> > sudarshan.bisht at 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


More information about the Alsa-devel mailing list