Re: [XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread David Miller
From: Eric Dumazet <[EMAIL PROTECTED]> Date: Wed, 09 Jan 2008 08:51:39 +0100 > Yes I have a patch for these divides, but will apply on 2.6.25 once this one > hits it. (this saves 192 bytes of kernel text BTW) I never doubted you for a second. -- To unsubscribe from this list: send the line "un

Re: [XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread Eric Dumazet
David Miller a écrit : From: Eric Dumazet <[EMAIL PROTECTED]> Date: Wed, 09 Jan 2008 08:29:11 +0100 Thanks for catching this. Applied to net-2.6 +static inline int xfrm_alg_len(struct xfrm_algo *alg) +{ + return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); +} That gets emitted as a di

Re: [XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread David Miller
From: Eric Dumazet <[EMAIL PROTECTED]> Date: Wed, 09 Jan 2008 08:29:11 +0100 Thanks for catching this. Applied to net-2.6 > +static inline int xfrm_alg_len(struct xfrm_algo *alg) > +{ > + return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); > +} That gets emitted as a divide doesn't it :-)))

Re: [XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread Eric Dumazet
static inline int alg_len(struct xfrm_algo *alg) Could you please add an xfrm prefix to this? Sure, thanks for the suggestion :) [XFRM]: xfrm_algo_clone() allocates too much memory alg_key_len is the length in bits of the key, not in bytes. Best way to fix this is to move alg_len() function from ne

Re: [XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread Herbert Xu
Eric Dumazet <[EMAIL PROTECTED]> wrote: > > diff --git a/include/net/xfrm.h b/include/net/xfrm.h > index 58dfa82..731f0a8 100644 > --- a/include/net/xfrm.h > +++ b/include/net/xfrm.h > @@ -1188,10 +1188,15 @@ static inline int xfrm_aevent_is_on(void) >return ret; > } > > +static inline in

[XFRM]: xfrm_algo_clone() allocates too much memory

2008-01-08 Thread Eric Dumazet
alg_key_len is the length in bits of the key, not in bytes. Best way to fix this is to move alg_len() function from net/xfrm/xfrm_user.c to include/net/xfrm.h, and to use it in xfrm_algo_clone() Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]> include/net/xfrm.h |7 ++- net/xfrm/xfr