Commit 1caf9958 authored by Michal Ludvig's avatar Michal Ludvig Committed by Patrick McHardy

[XFRM_USER]: In xfrm_send_{acquire,policy_notify}(), use {RTA,NLMSG}_SPACE().

parent 90af6e35
...@@ -1052,9 +1052,8 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt, ...@@ -1052,9 +1052,8 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt,
struct sk_buff *skb; struct sk_buff *skb;
size_t len; size_t len;
len = RTA_LENGTH(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
len = RTA_ALIGN(len); len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire));
len += NLMSG_ALIGN(NLMSG_LENGTH(sizeof(struct xfrm_user_acquire)));
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -1151,9 +1150,8 @@ static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, int hard) ...@@ -1151,9 +1150,8 @@ static int xfrm_send_policy_notify(struct xfrm_policy *xp, int dir, int hard)
struct sk_buff *skb; struct sk_buff *skb;
size_t len; size_t len;
len = sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr; len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr);
len = RTA_ALIGN(RTA_LENGTH(len)); len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));
len += NLMSG_ALIGN(NLMSG_LENGTH(sizeof(struct xfrm_user_polexpire)));
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment