netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipva: fix uninitialized variable warning
@ 2019-06-13 17:28 Charles
  2019-06-15 20:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Charles @ 2019-06-13 17:28 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: netdev, linux-kernel, rodrigosiqueiramelo

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(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ipva: fix uninitialized variable warning
  2019-06-13 17:28 [PATCH] net: ipva: fix uninitialized variable warning Charles
@ 2019-06-15 20:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-15 20:36 UTC (permalink / raw)
  To: 18oliveira.charles
  Cc: kuznet, yoshfuji, netdev, linux-kernel, rodrigosiqueiramelo

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-15 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 17:28 [PATCH] net: ipva: fix uninitialized variable warning Charles
2019-06-15 20:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).