Skip to content

Commit

Permalink
xfrm: Stop using NLA_PUT*().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Apr 2, 2012
1 parent 9d83ba4 commit e545d71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e545d71

Please sign in to comment.