[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>
This commit is contained in:

committed by
David S. Miller

parent
a94f723d59
commit
339bf98ffc
@@ -241,6 +241,12 @@ static u32 dn_fib_rule_default_pref(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t dn_fib_rule_nlmsg_payload(struct fib_rule *rule)
|
||||
{
|
||||
return nla_total_size(2) /* dst */
|
||||
+ nla_total_size(2); /* src */
|
||||
}
|
||||
|
||||
int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
return fib_rules_dump(skb, cb, AF_DECnet);
|
||||
|
Reference in New Issue
Block a user