[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131018.155833.1412406960170647411.davem@davemloft.net>
Date: Fri, 18 Oct 2013 15:58:33 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: fan.du@...driver.com
Cc: steffen.klassert@...unet.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] {selinux, af_key} Rework
pfkey_sadb2xfrm_user_sec_ctx
From: Fan Du <fan.du@...driver.com>
Date: Wed, 16 Oct 2013 14:15:14 +0800
> Taking advantages of sadb_x_sec_ctx and xfrm_user_sec_ctx share the same
> structure arrangement, rework pfkey_sadb2xfrm_user_sec_ctx by casting
> sadb_x_sec_ctx into xfrm_user_sec_ctx with minor len fix.
>
> Then we can:
> -Avoid kmalloc/free memory for xfrm_user_sec_ctx, sadb_x_sec_ctx would be fine.
> -Fix missing return value check bug for pfkey_compile_policy when kmalloc fails
>
> Signed-off-by: Fan Du <fan.du@...driver.com>
This isn't safe, one structure is packed and the other is not.
Furthermore, unless there is some enormous gain (in this case there
is not) losing the type checking by casting two data structures like
this is undesirable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists