aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-01 18:51:07 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-01 18:51:39 -0400
commit5e8d1eb5fb51e5b9d266a611133fea808320ab97 (patch)
tree6f37d5c7154c50be2d2204349e22afeda4660f6c /net
parent4925a459e96767e84b112c023c3766d4aeefb611 (diff)
nf_conntrack_proto_sctp: 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_sctp.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 72b5088592dc..996db2fa21f7 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -482,15 +482,12 @@ static int sctp_to_nlattr(struct sk_buff *skb, struct nlattr *nla,
482 if (!nest_parms) 482 if (!nest_parms)
483 goto nla_put_failure; 483 goto nla_put_failure;
484 484
485 NLA_PUT_U8(skb, CTA_PROTOINFO_SCTP_STATE, ct->proto.sctp.state); 485 if (nla_put_u8(skb, CTA_PROTOINFO_SCTP_STATE, ct->proto.sctp.state) ||
486 486 nla_put_be32(skb, CTA_PROTOINFO_SCTP_VTAG_ORIGINAL,
487 NLA_PUT_BE32(skb, 487 ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL]) ||
488 CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, 488 nla_put_be32(skb, CTA_PROTOINFO_SCTP_VTAG_REPLY,
489 ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL]); 489 ct->proto.sctp.vtag[IP_CT_DIR_REPLY]))
490 490 goto nla_put_failure;
491 NLA_PUT_BE32(skb,
492 CTA_PROTOINFO_SCTP_VTAG_REPLY,
493 ct->proto.sctp.vtag[IP_CT_DIR_REPLY]);
494 491
495 spin_unlock_bh(&ct->lock); 492 spin_unlock_bh(&ct->lock);
496 493
@@ -578,9 +575,10 @@ sctp_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data)
578 const unsigned int *timeouts = data; 575 const unsigned int *timeouts = data;
579 int i; 576 int i;
580 577
581 for (i=CTA_TIMEOUT_SCTP_UNSPEC+1; i<CTA_TIMEOUT_SCTP_MAX+1; i++) 578 for (i=CTA_TIMEOUT_SCTP_UNSPEC+1; i<CTA_TIMEOUT_SCTP_MAX+1; i++) {
582 NLA_PUT_BE32(skb, i, htonl(timeouts[i] / HZ)); 579 if (nla_put_be32(skb, i, htonl(timeouts[i] / HZ)))
583 580 goto nla_put_failure;
581 }
584 return 0; 582 return 0;
585 583
586nla_put_failure: 584nla_put_failure: