From: Sudarshan Bisht <sudarshan.bisht@nokia.com>
To: ext Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/3 v3] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker.
Date: Tue, 05 Apr 2011 10:29:20 +0300 [thread overview]
Message-ID: <1301988560.16314.248.camel@Sudarshan.research.nokia.com> (raw)
In-Reply-To: <20110404091823.GA18247@sirena.org.uk>
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@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@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
prev parent reply other threads:[~2011-04-05 7:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 8:53 [PATCH 1/3 v3] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker sudarshan.bisht
2011-04-04 8:53 ` [PATCH 2/3 v3] alsa-lib: fixed coverity reported issues under "RESOURCE_LEAK" checker sudarshan.bisht
2011-04-04 17:30 ` Steve Calfee
2011-04-05 7:45 ` Sudarshan Bisht
2011-04-04 8:53 ` [PATCH 3/3 v3] alsa-lib: fixed coverity reported issues under "USE_AFTER_FREE" checker sudarshan.bisht
2011-04-04 9:12 ` Paul Menzel
2011-04-04 10:02 ` Sudarshan Bisht
2011-04-04 9:18 ` [PATCH 1/3 v3] alsa-lib: fixed coverity reported issues under "FORWARD_NULL" checker Mark Brown
2011-04-04 10:35 ` Takashi Iwai
2011-04-04 11:49 ` Mark Brown
2011-04-05 7:29 ` Sudarshan Bisht [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=1301988560.16314.248.camel@Sudarshan.research.nokia.com \
--to=sudarshan.bisht@nokia.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).