* [PATCH 0/1] Fixed issues/defects reported by Coverity tool
@ 2011-03-17 9:28 sudarshan.bisht
2011-03-17 9:28 ` [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker sudarshan.bisht
0 siblings, 1 reply; 4+ messages in thread
From: sudarshan.bisht @ 2011-03-17 9:28 UTC (permalink / raw)
To: alsa-devel
From: Sudarshan <sudarshan.bisht@nokia.com>
Coverity Static Analysis helps developers find hard-to-spot,
yet potentially crash-causing defects early in the development phase,
reducing the cost,time, and risk of software errors.
This patch has a fix for a situation where variable can become NULL
after certain function call, but later not been checked before passing to
the next function call.
Sudarshan (1):
alsa-lib: fixed coverity reported issues under "REVERSE_INULL"
checker.
src/control/setup.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker. 2011-03-17 9:28 [PATCH 0/1] Fixed issues/defects reported by Coverity tool sudarshan.bisht @ 2011-03-17 9:28 ` sudarshan.bisht 2011-03-17 11:29 ` Clemens Ladisch 0 siblings, 1 reply; 4+ messages in thread From: sudarshan.bisht @ 2011-03-17 9:28 UTC (permalink / raw) To: alsa-devel From: Sudarshan <sudarshan.bisht@nokia.com> --- src/control/setup.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/control/setup.c b/src/control/setup.c index eecda45..79f2b76 100644 --- 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; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker. 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 2011-03-17 14:02 ` Sudarshan Bisht 0 siblings, 1 reply; 4+ messages in thread From: Clemens Ladisch @ 2011-03-17 11:29 UTC (permalink / raw) To: sudarshan.bisht; +Cc: alsa-devel 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] alsa-lib: fixed coverity reported issues under "REVERSE_INULL" checker. 2011-03-17 11:29 ` Clemens Ladisch @ 2011-03-17 14:02 ` Sudarshan Bisht 0 siblings, 0 replies; 4+ messages in thread From: Sudarshan Bisht @ 2011-03-17 14:02 UTC (permalink / raw) To: ext Clemens Ladisch; +Cc: alsa-devel On Thu, 2011-03-17 at 12:29 +0100, ext Clemens Ladisch wrote: > 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. Ok. > > > Regards, > Clemens ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-17 14:04 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2011-03-17 14:02 ` Sudarshan Bisht
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).