diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-01 18:53:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-01 18:53:24 -0400 |
commit | 516ee48f0be93ea5b41eaa5f7c5e06246447e575 (patch) | |
tree | ea5fddd533a654575308253e6e8114cd7ba737c4 /net | |
parent | f577694143b8024e95b2c0b680ab2071424bb1c7 (diff) |
nf_conntrack_proto_dccp: 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_dccp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index 24fdce256cb0..a58998d0912f 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -643,11 +643,12 @@ static int dccp_to_nlattr(struct sk_buff *skb, struct nlattr *nla, | |||
643 | nest_parms = nla_nest_start(skb, CTA_PROTOINFO_DCCP | NLA_F_NESTED); | 643 | nest_parms = nla_nest_start(skb, CTA_PROTOINFO_DCCP | NLA_F_NESTED); |
644 | if (!nest_parms) | 644 | if (!nest_parms) |
645 | goto nla_put_failure; | 645 | goto nla_put_failure; |
646 | NLA_PUT_U8(skb, CTA_PROTOINFO_DCCP_STATE, ct->proto.dccp.state); | 646 | if (nla_put_u8(skb, CTA_PROTOINFO_DCCP_STATE, ct->proto.dccp.state) || |
647 | NLA_PUT_U8(skb, CTA_PROTOINFO_DCCP_ROLE, | 647 | nla_put_u8(skb, CTA_PROTOINFO_DCCP_ROLE, |
648 | ct->proto.dccp.role[IP_CT_DIR_ORIGINAL]); | 648 | ct->proto.dccp.role[IP_CT_DIR_ORIGINAL]) || |
649 | NLA_PUT_BE64(skb, CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, | 649 | nla_put_be64(skb, CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, |
650 | cpu_to_be64(ct->proto.dccp.handshake_seq)); | 650 | cpu_to_be64(ct->proto.dccp.handshake_seq))) |
651 | goto nla_put_failure; | ||
651 | nla_nest_end(skb, nest_parms); | 652 | nla_nest_end(skb, nest_parms); |
652 | spin_unlock_bh(&ct->lock); | 653 | spin_unlock_bh(&ct->lock); |
653 | return 0; | 654 | return 0; |
@@ -739,9 +740,10 @@ dccp_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data) | |||
739 | const unsigned int *timeouts = data; | 740 | const unsigned int *timeouts = data; |
740 | int i; | 741 | int i; |
741 | 742 | ||
742 | for (i=CTA_TIMEOUT_DCCP_UNSPEC+1; i<CTA_TIMEOUT_DCCP_MAX+1; i++) | 743 | for (i=CTA_TIMEOUT_DCCP_UNSPEC+1; i<CTA_TIMEOUT_DCCP_MAX+1; i++) { |
743 | NLA_PUT_BE32(skb, i, htonl(timeouts[i] / HZ)); | 744 | if (nla_put_be32(skb, i, htonl(timeouts[i] / HZ))) |
744 | 745 | goto nla_put_failure; | |
746 | } | ||
745 | return 0; | 747 | return 0; |
746 | 748 | ||
747 | nla_put_failure: | 749 | nla_put_failure: |