[PATCH] huawei: fix uninitialized variable issues
Aleksander Morgado
aleksander at lanedo.com
Wed Sep 4 22:35:58 PDT 2013
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
More information about the ModemManager-devel
mailing list