net: ipv4: fib_semantics: fix uninitialized variable
authorEnrico Weigelt <info@metux.net>
Thu, 6 Jun 2019 14:43:17 +0000 (16:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 9 Jun 2019 19:47:30 +0000 (12:47 -0700)
fix an uninitialized variable:

  CC      net/ipv4/fib_semantics.o
net/ipv4/fib_semantics.c: In function 'fib_check_nh_v4_gw':
net/ipv4/fib_semantics.c:1027:12: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (!tbl || err) {
            ^~

Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_semantics.c

index b80410673915094255824d4e4b5fbdad292fd4c8..bfa49a88d03ae570261646730eed24d4cc27e36c 100644 (file)
@@ -964,7 +964,7 @@ static int fib_check_nh_v4_gw(struct net *net, struct fib_nh *nh, u32 table,
 {
        struct net_device *dev;
        struct fib_result res;
-       int err;
+       int err = 0;
 
        if (nh->fib_nh_flags & RTNH_F_ONLINK) {
                unsigned int addr_type;