[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1357420764-12381-1-git-send-email-xi.wang@gmail.com>
Date: Sat, 5 Jan 2013 16:19:24 -0500
From: Xi Wang <xi.wang@...il.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Xi Wang <xi.wang@...il.com>
Subject: [PATCH] ipv4: fix NULL checking in devinet_ioctl()
The NULL pointer check `!ifa' should come before its first use.
Signed-off-by: Xi Wang <xi.wang@...il.com>
---
net/ipv4/devinet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cc06a47..a8e4f26 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -823,9 +823,9 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
if (!ifa) {
ret = -ENOBUFS;
ifa = inet_alloc_ifa();
- INIT_HLIST_NODE(&ifa->hash);
if (!ifa)
break;
+ INIT_HLIST_NODE(&ifa->hash);
if (colon)
memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
else
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists