netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: fix NULL checking in devinet_ioctl()
@ 2013-01-05 21:19 Xi Wang
  2013-01-05 23:10 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Wang @ 2013-01-05 21:19 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Xi Wang

The NULL pointer check `!ifa' should come before its first use.

Signed-off-by: Xi Wang <xi.wang@gmail.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

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

end of thread, other threads:[~2013-01-07  5:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05 21:19 [PATCH] ipv4: fix NULL checking in devinet_ioctl() Xi Wang
2013-01-05 23:10 ` Eric Dumazet
2013-01-07  5:11   ` 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).