[alsa-devel] [PATCH 1/3 v3] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker.
Sudarshan Bisht
sudarshan.bisht at nokia.com
Tue Apr 5 09:29:20 CEST 2011
On Mon, 2011-04-04 at 10:18 +0100, ext Mark Brown wrote:
> On Mon, Apr 04, 2011 at 11:53:57AM +0300, sudarshan.bisht at nokia.com wrote:
>
> > This patch has fix for situations where variable can be NULL
> > but not been checked beforehand.
>
> This description doesn't seem to match the patch...
>
> > - if (h == NULL)
> > + if (h)
> > snd_dlclose(h);
>
> This is a coding style change, the two conditions are equivalent.
>
> > SNDERR("Invalid type for func %s definition", str);
> > + err = -EINVAL;
> > goto _err;
>
> This appears to be fixing an uninitialised return value error.
>
> > return err;
> > if (periods == 1)
> > return -EINVAL;
> > - if (*period_time == 0) {
> > + if (period_time) {
> > err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
> > if (err < 0)
>
> This check alters the semantics - rather than checking if *period_time is
> non-zero we now check to see if period_time is non-NULL, paying no
> attention to the value if the pointer is set.
If "period_time == NULL" ( in preceding if condition) is true then "if
(*period_time == 0)" has no meaning ( causes segmentation fault ) and
if "*period_time == 0" ( in preceding if condition) is true then
obviously period_time will be a valid pointer and satisfy the condition.
Thats what original source
codes demands.
>
> There was at least one relevant fix in there but lots of the changes are
> as above.
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
More information about the Alsa-devel
mailing list