[PATCH] net: ipva: fix uninitialized variable warning

From: Charles
Date: Thu Jun 13 2019 - 13:33:50 EST


Avoid following compiler warning on uninitialized variable

net/ipv4/fib_semantics.c: In function âfib_check_nh_v4_gwâ:
net/ipv4/fib_semantics.c:1023:12: warning: âerrâ may be used
uninitialized in this function [-Wmaybe-uninitialized]
if (!tbl || err) {

Signed-off-by: Charles Oliveira <18oliveira.charles@xxxxxxxxx>
---
net/ipv4/fib_semantics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index b80410673915..ae47e046695c 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -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 = -EINVAL;

if (nh->fib_nh_flags & RTNH_F_ONLINK) {
unsigned int addr_type;
--
2.11.0