[Babel-users] [PATCH 3/6] Quiet the compiler on two uninitialized variable warnings
Dave Taht
dave.taht at gmail.com
Thu Mar 9 15:55:00 UTC 2017
From: Dave Taht <dave at taht.net>
When compiled on arm and gcc 4.9.2, the compiler picks out two sets of
variables passed by reference that "might be used uninitialized".
They aren't, but certainly in the getnet case it was not immediately
obvious to either me or the compiler.
Quiet the warnings by explicitly initializing these variables.
---
configuration.c | 4 ++--
route.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configuration.c b/configuration.c
index c4b4d55..b455181 100644
--- a/configuration.c
+++ b/configuration.c
@@ -273,8 +273,8 @@ getnet(int c, unsigned char **p_r, unsigned char *plen_r, int *af_r,
char *t;
unsigned char *ip;
unsigned char addr[16];
- unsigned char plen;
- int af, rc;
+ unsigned char plen = 0;
+ int af = 0, rc = 0;
c = getword(c, &t, gnc, closure);
if(c < -1)
diff --git a/route.c b/route.c
index a4cd302..5cd2260 100644
--- a/route.c
+++ b/route.c
@@ -212,7 +212,7 @@ resize_route_table(int new_slots)
static struct babel_route *
insert_route(struct babel_route *route)
{
- int i, n;
+ int i, n = 0;
assert(!route->installed);
--
2.7.4
More information about the Babel-users
mailing list