Patchwork [net-next] netpoll: fix an uninitialized variable

login
register
mail settings
Submitter Amerigo Wang
Date Jan. 23, 2013, 3:39 a.m.
Message ID <1358912351-14835-1-git-send-email-amwang@redhat.com>
Download mbox | patch
Permalink /patch/214720/
State Accepted
Delegated to: David Miller
Headers show

Comments

Amerigo Wang - Jan. 23, 2013, 3:39 a.m.
From: Cong Wang <amwang@redhat.com>

Fengguang reported:

   net/core/netpoll.c: In function 'netpoll_setup':
   net/core/netpoll.c:1049:6: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]

in !CONFIG_IPV6 case, we may error out without initializing
'err'.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 23, 2013, 4:22 a.m.
From: Cong Wang <amwang@redhat.com>
Date: Wed, 23 Jan 2013 11:39:11 +0800

> From: Cong Wang <amwang@redhat.com>
> 
> Fengguang reported:
> 
>    net/core/netpoll.c: In function 'netpoll_setup':
>    net/core/netpoll.c:1049:6: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> in !CONFIG_IPV6 case, we may error out without initializing
> 'err'.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a9b1004..e2f79a1 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -1140,6 +1140,7 @@  int netpoll_setup(struct netpoll *np)
 #else
 			np_err(np, "IPv6 is not supported %s, aborting\n",
 			       np->dev_name);
+			err = -EINVAL;
 			goto put;
 #endif
 		}