[PATCH] huawei: fix uninitialized variable issues

Ben Chan benchan at chromium.org
Thu Sep 5 00:01:47 PDT 2013


Thanks Aleksander.  I missed it in the last review as well.

Ben


On Wed, Sep 4, 2013 at 10:35 PM, Aleksander Morgado
<aleksander at lanedo.com>wrote:

> On 05/09/13 00:31, Ben Chan wrote:
> > This patch fixes the following uninitialized variable issues, which was
> > introduced in the previous commit "huawei: retry connect/disconnect
> attempt
> > upon ^NDISSTATQRY? failures" (commit
> 57c657bd066366db6892ac2a8adfec2ca209ccbe).
> >
> > huawei/mm-broadband-bearer-huawei.c:127:9: error: variable
> 'ipv4_available' is used uninitialized whenever '||' condition is true
> >       [-Werror,-Wsometimes-uninitialized]
> >     if (!response ||
> >         ^~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:141:9: note: uninitialized use
> occurs here
> >     if (ipv4_available && ipv4_connected) {
> >         ^~~~~~~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:127:9: note: remove the '||' if its
> condition is always false
> >     if (!response ||
> >         ^~~~~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:115:28: note: initialize the
> variable 'ipv4_available' to silence this warning
> >     gboolean ipv4_available;
> >                            ^
> >                             = 0
> > huawei/mm-broadband-bearer-huawei.c:484:9: error: variable
> 'ipv4_available' is used uninitialized whenever '||' condition is true
> >       [-Werror,-Wsometimes-uninitialized]
> >     if (!response ||
> >         ^~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:498:9: note: uninitialized use
> occurs here
> >     if (ipv4_available && !ipv4_connected) {
> >         ^~~~~~~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:484:9: note: remove the '||' if its
> condition is always false
> >     if (!response ||
> >         ^~~~~~~~~~~~
> > huawei/mm-broadband-bearer-huawei.c:472:28: note: initialize the
> variable 'ipv4_available' to silence this warning
> >     gboolean ipv4_available;
> >                            ^
> >                             = 0
> > ---
>
> Oops; and this is my fault during the previous patch review :)
>
>
> >  plugins/huawei/mm-broadband-bearer-huawei.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c
> b/plugins/huawei/mm-broadband-bearer-huawei.c
> > index 38892d9..eec37f3 100644
> > --- a/plugins/huawei/mm-broadband-bearer-huawei.c
> > +++ b/plugins/huawei/mm-broadband-bearer-huawei.c
> > @@ -112,10 +112,10 @@ connect_ndisstatqry_check_ready (MMBaseModem
> *modem,
> >      Connect3gppContext *ctx;
> >      const gchar *response;
> >      GError *error = NULL;
> > -    gboolean ipv4_available;
> > -    gboolean ipv4_connected;
> > -    gboolean ipv6_available;
> > -    gboolean ipv6_connected;
> > +    gboolean ipv4_available = FALSE;
> > +    gboolean ipv4_connected = FALSE;
> > +    gboolean ipv6_available = FALSE;
> > +    gboolean ipv6_connected = FALSE;
> >
> >      ctx = self->priv->connect_pending;
> >      g_assert (ctx != NULL);
> > @@ -469,10 +469,10 @@ disconnect_ndisstatqry_check_ready (MMBaseModem
> *modem,
> >      Disconnect3gppContext *ctx;
> >      const gchar *response;
> >      GError *error = NULL;
> > -    gboolean ipv4_available;
> > -    gboolean ipv4_connected;
> > -    gboolean ipv6_available;
> > -    gboolean ipv6_connected;
> > +    gboolean ipv4_available = FALSE;
> > +    gboolean ipv4_connected = FALSE;
> > +    gboolean ipv6_available = FALSE;
> > +    gboolean ipv6_connected = FALSE;
> >
> >      ctx = self->priv->disconnect_pending;
> >      g_assert (ctx != NULL);
> >
>
>
> --
> Aleksander
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20130905/5a8a7c83/attachment-0001.html>


More information about the ModemManager-devel mailing list