diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 18:48:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-01 18:48:06 -0400 |
commit | 3c60a17b1b55ac4a72382502c952222b7649d63b (patch) | |
tree | de12d1001b5d76cb35d7ab6ccba8b61eee19efb7 /net | |
parent | 7c8011895330d3069b137233e2673f40ee6f4c91 (diff) |
nf_conntrack_proto_udp{,lite}: 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/nf_conntrack_proto_udp.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udplite.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index a9073dc1548d..7259a6bdeb49 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -181,10 +181,11 @@ udp_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data) | |||
181 | { | 181 | { |
182 | const unsigned int *timeouts = data; | 182 | const unsigned int *timeouts = data; |
183 | 183 | ||
184 | NLA_PUT_BE32(skb, CTA_TIMEOUT_UDP_UNREPLIED, | 184 | if (nla_put_be32(skb, CTA_TIMEOUT_UDP_UNREPLIED, |
185 | htonl(timeouts[UDP_CT_UNREPLIED] / HZ)); | 185 | htonl(timeouts[UDP_CT_UNREPLIED] / HZ)) || |
186 | NLA_PUT_BE32(skb, CTA_TIMEOUT_UDP_REPLIED, | 186 | nla_put_be32(skb, CTA_TIMEOUT_UDP_REPLIED, |
187 | htonl(timeouts[UDP_CT_REPLIED] / HZ)); | 187 | htonl(timeouts[UDP_CT_REPLIED] / HZ))) |
188 | goto nla_put_failure; | ||
188 | return 0; | 189 | return 0; |
189 | 190 | ||
190 | nla_put_failure: | 191 | nla_put_failure: |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index e0606392cda0..4d60a5376aa6 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -185,10 +185,11 @@ udplite_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data) | |||
185 | { | 185 | { |
186 | const unsigned int *timeouts = data; | 186 | const unsigned int *timeouts = data; |
187 | 187 | ||
188 | NLA_PUT_BE32(skb, CTA_TIMEOUT_UDPLITE_UNREPLIED, | 188 | if (nla_put_be32(skb, CTA_TIMEOUT_UDPLITE_UNREPLIED, |
189 | htonl(timeouts[UDPLITE_CT_UNREPLIED] / HZ)); | 189 | htonl(timeouts[UDPLITE_CT_UNREPLIED] / HZ)) || |
190 | NLA_PUT_BE32(skb, CTA_TIMEOUT_UDPLITE_REPLIED, | 190 | nla_put_be32(skb, CTA_TIMEOUT_UDPLITE_REPLIED, |
191 | htonl(timeouts[UDPLITE_CT_REPLIED] / HZ)); | 191 | htonl(timeouts[UDPLITE_CT_REPLIED] / HZ))) |
192 | goto nla_put_failure; | ||
192 | return 0; | 193 | return 0; |
193 | 194 | ||
194 | nla_put_failure: | 195 | nla_put_failure: |