mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
[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:
parent
a94f723d59
commit
339bf98ffc
21 changed files with 233 additions and 107 deletions
|
@ -77,8 +77,7 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,
|
|||
/*
|
||||
* If new attributes are added, please revisit this allocation
|
||||
*/
|
||||
size = nlmsg_total_size(genlmsg_total_size(size));
|
||||
skb = nlmsg_new(size, GFP_KERNEL);
|
||||
skb = nlmsg_new(genlmsg_total_size(size), GFP_KERNEL);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue