From: David S. Miller <davem@davemloft.net>
Date: Mon, 2 Apr 2012 01:04:21 +0000 (-0400)
Subject: xfrm: Stop using NLA_PUT*().
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e545d71390b50a8dab75efb182a4adc3c2603962;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

xfrm: Stop using NLA_PUT*().

These macros contain a hidden goto, and are thus extremely error
prone and make code hard to audit.

Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 96239e78e621..1cb32bf107de 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1682,8 +1682,9 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
 
 static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
 {
-	if (m->m | m->v)
-		NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
+	if ((m->m | m->v) &&
+	    nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
+		goto nla_put_failure;
 	return 0;
 
 nla_put_failure: