All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: check return value for dst_alloc
@ 2011-09-26 17:04 Madalin Bucur
  2011-09-27 19:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Madalin Bucur @ 2011-09-26 17:04 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, davem, timo.teras, Madalin Bucur

return value of dst_alloc must be checked before use

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 net/xfrm/xfrm_policy.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 94fdcc7..552df27 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1349,14 +1349,16 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
 		BUG();
 	}
 	xdst = dst_alloc(dst_ops, NULL, 0, 0, 0);
-	memset(&xdst->u.rt6.rt6i_table, 0, sizeof(*xdst) - sizeof(struct dst_entry));
-	xfrm_policy_put_afinfo(afinfo);
 
-	if (likely(xdst))
+	if (likely(xdst)) {
+		memset(&xdst->u.rt6.rt6i_table, 0,
+			sizeof(*xdst) - sizeof(struct dst_entry));
 		xdst->flo.ops = &xfrm_bundle_fc_ops;
-	else
+	} else
 		xdst = ERR_PTR(-ENOBUFS);
 
+	xfrm_policy_put_afinfo(afinfo);
+
 	return xdst;
 }
 
-- 
1.7.0.1

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

* Re: [PATCH 1/2] net: check return value for dst_alloc
  2011-09-26 17:04 [PATCH 1/2] net: check return value for dst_alloc Madalin Bucur
@ 2011-09-27 19:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-09-27 19:32 UTC (permalink / raw)
  To: madalin.bucur; +Cc: eric.dumazet, netdev, timo.teras

From: Madalin Bucur <madalin.bucur@freescale.com>
Date: Mon, 26 Sep 2011 20:04:36 +0300

> return value of dst_alloc must be checked before use
> 
> Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>

Applied.

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

end of thread, other threads:[~2011-09-27 19:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-26 17:04 [PATCH 1/2] net: check return value for dst_alloc Madalin Bucur
2011-09-27 19:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.