All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Date: Thu, 06 Jan 2011 19:28:30 -0800	[thread overview]
Message-ID: <1294370910.2501.16.camel@aeonflux> (raw)
In-Reply-To: <FC2FB65B4D919844ADE4BE3C2BB739AD34CC43F8@shsmsx501.ccr.corp.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]

Hi Martin,

> > >  src/call-forwarding.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c
> > > index 512f223..36ba4f1 100644
> > > --- a/src/call-forwarding.c
> > > +++ b/src/call-forwarding.c
> > > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct
> > ofono_call_forwarding *cf,
> > >  static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
> > >  {
> > >  	gboolean cfu_voice;
> > > -	struct ofono_call_forwarding_condition *cond;
> > > +	struct ofono_call_forwarding_condition *cond = NULL;
> > >
> > >  	cfu_voice = is_cfu_enabled(cf, &cond);
> > 
> > I really hate trying to fix compiler warnings like this.
> > 
> >         /*
> >          * For now we only support Voice, although Fax & all Data
> >          * basic services are applicable as well.
> >          */
> >         for (; l; l = l->next) {
> >                 cond = l->data;
> > 
> >                 if (cond->cls > BEARER_CLASS_VOICE)
> >                         continue;
> > 
> >                 if (out)
> >                         *out = cond;
> > 
> >                 return TRUE;
> >         }
> > 
> >         return FALSE;
> > 
> > So this is clearly a false positive. The only why this would fail is
> This is not a false positive, it is quite possible not to reach the "for(;;)" branch, and uninitialized the *cond.
> I have added
> *out = NULL;
> Out of the branch, and found that the warning gone.
> So here I think gcc is right, and we need the patch.

it is a false positive.

The only caller that uses the cond value is sim_set_cf_indicator. And it
only uses conf if the return value is TRUE. So where can this go wrong?

Regards

Marcel



  reply	other threads:[~2011-01-07  3:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 10:33 [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1 martin.xu
2011-01-06 17:44 ` Marcel Holtmann
2011-01-07  2:53   ` Xu, Martin
2011-01-07  3:28     ` Marcel Holtmann [this message]
2011-01-07  6:52       ` Xu, Martin
  -- strict thread matches above, loose matches on Subject: below --
2011-01-06  9:46 martin.xu
2011-01-06  9:49 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2011-01-06 10:01   ` Xu, Martin
2011-01-06  9:54 ` Xu, Martin
2011-01-06 14:00   ` Lucas De Marchi

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=1294370910.2501.16.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=ofono@ofono.org \
    /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.