diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-11-10 17:10:15 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:11 -0500 |
commit | 339bf98ffc6a8d8eb16fc532ac57ffbced2f8a68 (patch) | |
tree | 499ad948863d2753ca10283dcf006ad28954538e /net/ipv6/fib6_rules.c | |
parent | a94f723d595ee085f81b1788d18e031af7eeba91 (diff) |
[NETLINK]: Do precise netlink message allocations where possible
Account for the netlink message header size directly in nlmsg_new()
instead of relying on the caller calculate it correctly.
Replaces error handling of message construction functions when
constructing notifications with bug traps since a failure implies
a bug in calculating the size of the skb.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 25804cb69cf0..d587dde5897e 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -232,6 +232,12 @@ static u32 fib6_rule_default_pref(void) | |||
232 | return 0x3FFF; | 232 | return 0x3FFF; |
233 | } | 233 | } |
234 | 234 | ||
235 | static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule) | ||
236 | { | ||
237 | return nla_total_size(16) /* dst */ | ||
238 | + nla_total_size(16); /* src */ | ||
239 | } | ||
240 | |||
235 | static struct fib_rules_ops fib6_rules_ops = { | 241 | static struct fib_rules_ops fib6_rules_ops = { |
236 | .family = AF_INET6, | 242 | .family = AF_INET6, |
237 | .rule_size = sizeof(struct fib6_rule), | 243 | .rule_size = sizeof(struct fib6_rule), |
@@ -241,6 +247,7 @@ static struct fib_rules_ops fib6_rules_ops = { | |||
241 | .compare = fib6_rule_compare, | 247 | .compare = fib6_rule_compare, |
242 | .fill = fib6_rule_fill, | 248 | .fill = fib6_rule_fill, |
243 | .default_pref = fib6_rule_default_pref, | 249 | .default_pref = fib6_rule_default_pref, |
250 | .nlmsg_payload = fib6_rule_nlmsg_payload, | ||
244 | .nlgroup = RTNLGRP_IPV6_RULE, | 251 | .nlgroup = RTNLGRP_IPV6_RULE, |
245 | .policy = fib6_rule_policy, | 252 | .policy = fib6_rule_policy, |
246 | .rules_list = &fib6_rules, | 253 | .rules_list = &fib6_rules, |