diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2016-04-22 11:31:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-23 20:13:25 -0400 |
commit | de95c4a46a6e608444ccaf541087594553c7df11 (patch) | |
tree | 1f82d354ca5c2c58ab6d77801c2fb072c06e3cec /net/xfrm | |
parent | 73520786b0793c612ef4de3e9addb2ec411bea20 (diff) |
xfrm: align nlattr properly when needed
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_user.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 2cc7af858c6f..d516845e16e3 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -809,7 +809,8 @@ static int copy_to_user_state_extra(struct xfrm_state *x, | |||
809 | goto out; | 809 | goto out; |
810 | } | 810 | } |
811 | if (x->lastused) { | 811 | if (x->lastused) { |
812 | ret = nla_put_u64(skb, XFRMA_LASTUSED, x->lastused); | 812 | ret = nla_put_u64_64bit(skb, XFRMA_LASTUSED, x->lastused, |
813 | XFRMA_PAD); | ||
813 | if (ret) | 814 | if (ret) |
814 | goto out; | 815 | goto out; |
815 | } | 816 | } |
@@ -1813,7 +1814,7 @@ static inline size_t xfrm_aevent_msgsize(struct xfrm_state *x) | |||
1813 | 1814 | ||
1814 | return NLMSG_ALIGN(sizeof(struct xfrm_aevent_id)) | 1815 | return NLMSG_ALIGN(sizeof(struct xfrm_aevent_id)) |
1815 | + nla_total_size(replay_size) | 1816 | + nla_total_size(replay_size) |
1816 | + nla_total_size(sizeof(struct xfrm_lifetime_cur)) | 1817 | + nla_total_size_64bit(sizeof(struct xfrm_lifetime_cur)) |
1817 | + nla_total_size(sizeof(struct xfrm_mark)) | 1818 | + nla_total_size(sizeof(struct xfrm_mark)) |
1818 | + nla_total_size(4) /* XFRM_AE_RTHR */ | 1819 | + nla_total_size(4) /* XFRM_AE_RTHR */ |
1819 | + nla_total_size(4); /* XFRM_AE_ETHR */ | 1820 | + nla_total_size(4); /* XFRM_AE_ETHR */ |
@@ -1848,7 +1849,8 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct | |||
1848 | } | 1849 | } |
1849 | if (err) | 1850 | if (err) |
1850 | goto out_cancel; | 1851 | goto out_cancel; |
1851 | err = nla_put(skb, XFRMA_LTIME_VAL, sizeof(x->curlft), &x->curlft); | 1852 | err = nla_put_64bit(skb, XFRMA_LTIME_VAL, sizeof(x->curlft), &x->curlft, |
1853 | XFRMA_PAD); | ||
1852 | if (err) | 1854 | if (err) |
1853 | goto out_cancel; | 1855 | goto out_cancel; |
1854 | 1856 | ||
@@ -2617,7 +2619,7 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x) | |||
2617 | l += nla_total_size(sizeof(x->props.extra_flags)); | 2619 | l += nla_total_size(sizeof(x->props.extra_flags)); |
2618 | 2620 | ||
2619 | /* Must count x->lastused as it may become non-zero behind our back. */ | 2621 | /* Must count x->lastused as it may become non-zero behind our back. */ |
2620 | l += nla_total_size(sizeof(u64)); | 2622 | l += nla_total_size_64bit(sizeof(u64)); |
2621 | 2623 | ||
2622 | return l; | 2624 | return l; |
2623 | } | 2625 | } |