diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 18:46:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-01 18:46:00 -0400 |
commit | 48f03bdad8b3b0f5a96db45d517149eccd7f4ca8 (patch) | |
tree | 79ec65b40737ed425f48bab62569055bb971dff9 /net | |
parent | 1db20a52950e329f308900f1c603bf05bb1bebc3 (diff) |
nfnetlink_cttimeout: 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>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink_cttimeout.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index 2b9e79f5ef05..3e655288d1d6 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c | |||
@@ -170,11 +170,12 @@ ctnl_timeout_fill_info(struct sk_buff *skb, u32 pid, u32 seq, u32 type, | |||
170 | nfmsg->version = NFNETLINK_V0; | 170 | nfmsg->version = NFNETLINK_V0; |
171 | nfmsg->res_id = 0; | 171 | nfmsg->res_id = 0; |
172 | 172 | ||
173 | NLA_PUT_STRING(skb, CTA_TIMEOUT_NAME, timeout->name); | 173 | if (nla_put_string(skb, CTA_TIMEOUT_NAME, timeout->name) || |
174 | NLA_PUT_BE16(skb, CTA_TIMEOUT_L3PROTO, htons(timeout->l3num)); | 174 | nla_put_be16(skb, CTA_TIMEOUT_L3PROTO, htons(timeout->l3num)) || |
175 | NLA_PUT_U8(skb, CTA_TIMEOUT_L4PROTO, timeout->l4proto->l4proto); | 175 | nla_put_u8(skb, CTA_TIMEOUT_L4PROTO, timeout->l4proto->l4proto) || |
176 | NLA_PUT_BE32(skb, CTA_TIMEOUT_USE, | 176 | nla_put_be32(skb, CTA_TIMEOUT_USE, |
177 | htonl(atomic_read(&timeout->refcnt))); | 177 | htonl(atomic_read(&timeout->refcnt)))) |
178 | goto nla_put_failure; | ||
178 | 179 | ||
179 | if (likely(l4proto->ctnl_timeout.obj_to_nlattr)) { | 180 | if (likely(l4proto->ctnl_timeout.obj_to_nlattr)) { |
180 | struct nlattr *nest_parms; | 181 | struct nlattr *nest_parms; |