diff options
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 58dfa82889aa..1dd20cf17982 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1188,10 +1188,15 @@ static inline int xfrm_aevent_is_on(void) | |||
1188 | return ret; | 1188 | return ret; |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | static inline int xfrm_alg_len(struct xfrm_algo *alg) | ||
1192 | { | ||
1193 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | ||
1194 | } | ||
1195 | |||
1191 | #ifdef CONFIG_XFRM_MIGRATE | 1196 | #ifdef CONFIG_XFRM_MIGRATE |
1192 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1197 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
1193 | { | 1198 | { |
1194 | return (struct xfrm_algo *)kmemdup(orig, sizeof(*orig) + orig->alg_key_len, GFP_KERNEL); | 1199 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); |
1195 | } | 1200 | } |
1196 | 1201 | ||
1197 | static inline void xfrm_states_put(struct xfrm_state **states, int n) | 1202 | static inline void xfrm_states_put(struct xfrm_state **states, int n) |