diff mbox series

net: ipva: fix uninitialized variable warning

Message ID 20190613172841.s4ig3p53wpd2z3nb@debie
State Not Applicable
Delegated to: David Miller
Headers show
Series net: ipva: fix uninitialized variable warning | expand

Commit Message

Charles June 13, 2019, 5:28 p.m. UTC
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@gmail.com>
---
 net/ipv4/fib_semantics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller June 15, 2019, 8:36 p.m. UTC | #1
From: Charles <18oliveira.charles@gmail.com>
Date: Thu, 13 Jun 2019 14:28:41 -0300

> 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@gmail.com>

This is already fixed in the 'net' GIT tree, please always submit networking
patches against the appropriate tree.

Thank you.
diff mbox series

Patch

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;